Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when mixin dgrid/extensions/DnD and dgrid/Selection #658

Closed
wants to merge 4 commits into from

Conversation

lsolano
Copy link

@lsolano lsolano commented Jul 12, 2013

The problem

When mixin dgrid/extensions/DnD and dgrid/Selection; using IE10 the mousedown event is reported as MSPointerDown. Because the Selection module is not listening for this new event the Grid's selection is always empty. Because the DnD extension relies on the Grid's selection (if any) it does not work as the later is always empty.

Tests

After testing in different borwsers (in a non-touch laptop), these are my findings about the event type reported:

IE (v 10.0.9200.16635, update 10.0.7)
  • IE10/Standars: evt.type = "MSPointerDown"
  • IE9/Standars 9: evt.type = "mousedown"
  • IE8/Standars 8: evt.type = "mousedown"
  • IE7/Standars 7: evt.type = "mousedown"
Chrome (v 29.0.1547.18 dev-m)

evt.type = "mousedown"

FireFox (v 22.0)

evt.type = "mousedown"

"Fix"

Add MSPointerDown and MSPointerUp to Selection.selectionEvents property.

Little investigation (in commit message)

MSPointerXXX events are inconsistent with the fact that has('touch') returs false. So in IE10 if you try to dedect a touch device 'has' reports false; but the browser fires events as MSPointerXXX.
The feature detection is a little dirty
if (window.navigator.msPointerEnabled) { // Must listen for MSPointerXXX events } else { // Classic event types };
or maybe
if (has('ie') && has('ie') >= 10) {...}

Information source http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx

…returs false. So in IE10 if you try to dedect a touch device 'has' reports false; but the browser fires events as MSPointerXXX.

The feature detection is a little dirty if (window.navigator.msPointerEnabled) {...} else {...}; or maybe (has('ie') && has('ie') >= 10)
Info source http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
@kfranqueiro
Copy link
Member

I can't seem to reproduce this issue in the test/Selection.html and test/extensions/DnD.html test pages - in the former, the selection object appears to update fine in IE10 based on mousedown and mouseup events, and in the DnD test page, selecting multiple items and dragging appears to work fine.

Moreover, if I apply the change you suggested, the logic in Selection ends up triggering multiple times, which is not something we would want.

Can you provide a reduced test case that shows the issue you're experiencing?

@lsolano
Copy link
Author

lsolano commented Jul 23, 2013

Yes I'll provide a test case.

One question: Did you have a test with all this mixins [OnDemandGrid,
Keyboard, Selection, DnD]?
Because my case (maybe I did not provide that info on the pull request), is
this exact one.

No matter what, I'll create a test case with this scenario and try to
reproduce this bug.

Tks,

On Tue, Jul 23, 2013 at 11:57 AM, Kenneth G. Franqueiro <
notifications@github.com> wrote:

I can't seem to reproduce this issue in the test/Selection.html and
test/extensions/DnD.html test pages - in the former, the selection object
appears to update fine in IE10 based on mousedown and mouseup events, and
in the DnD test page, selecting multiple items and dragging appears to work
fine.

Moreover, if I apply the change you suggested, the logic in Selection ends
up triggering multiple times, which is not something we would want.

Can you provide a reduced test case that shows the issue you're
experiencing?


Reply to this email directly or view it on GitHubhttps://github.com//pull/658#issuecomment-21424625
.

Ing. Lorenzo Solano Martínez

e-mail: lorenzo.sm@gmail.com

Cell phone: +1-829-276-7676

LinkedIn: http://do.linkedin.com/pub/lorenzo-solano/33/551/a84
Skype ID: lsolano.rd

@kfranqueiro
Copy link
Member

Yes, the grids in the DnD test page (which is one of the pages I tested with) include all of those mixins.

Looking forward to your test case, thanks!

@lsolano
Copy link
Author

lsolano commented Jul 23, 2013

There you have it (DnD_Selection_Keyboard_OnDemandGrid_IE10_Events.html) is a C&P of DnD.html with just the first Grid on it.

I tested the case using the latest (dev) version of dojo (to see if the issue is related to the version of dojo/on), and later with the 1.9.1 version of dojo, but with both got the same result. The Drag 'n' Drop does not work if I remove the added events to Selection.

Steps to reproduce (Failure)
  • Go to Selection:line 106 (dgrid\Selection) and make sure you have the original line selectionEvents: "mousedown,mouseup,dgrid-cellfocusin",
  • Go open the test file dgrid\tests\extensions\DnD_Selection_Keyboard_OnDemandGrid_IE10_Events.txt, using IE10 (Broser Mode: IE10, and Document Mode: Standards)
  • Try to Drag 'n' Drop the grid lines using the mouse. Validate that it isn't possible.
Steps to reproduce (the "Fix")
  • Go to Selection:line 106 (dgrid\Selection) and change the linte to this value selectionEvents: "MSPointerDown,mousedown,MSPointerUp,mouseup,dgrid-cellfocusin",
  • Go open the test file dgrid\tests\extensions\DnD_Selection_Keyboard_OnDemandGrid_IE10_Events.txt, using IE10 (Broser Mode: IE10, and Document Mode: Standards)
  • Try to Drag 'n' Drop the grid lines using the mouse. Validate that it is possible.

Note: I don't know if, by design, dgrid's modules "trust" in dojo/on to normalize this kind of situation, that's why I'm not sure if the submitted code is the appropriated solution.

@kfranqueiro
Copy link
Member

Okay, when I first tested this I didn't realize the issue was specific to running against Dojo 1.9, so that was my problem. I can see the issue plainly in dgrid's DnD test page with Dojo 1.9.1 + IE10. Thanks for the extra info.

@lsolano
Copy link
Author

lsolano commented Jul 31, 2013

You're welcome

@ghost ghost closed this in 80e72ec Jul 31, 2013
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants