-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[WIP] Mouse: Switch to pointer events, via PEP #1611
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
Conversation
@arschmitz could you take a look at my TODO list above? No need to dig into anything in detail, just some highlevel feedback on each item. |
@bethge would you be interested in working with me on this? Getting draggable to work in Windows Phone and fixing any of the failing unit tests would be great. |
Yes, sounds great! - I'll dive in. |
A few quick comments on the list above
We already chose not to support ie8 in 1.13
need to dig deeper but probably a
|
That makes it a lot easier.
Might be of help to @bethge.
That sounds promising. Will see if thats available before Phantom 2.x. |
I went for Just to get it right: We have I will try to figure out why those drags on iOS won't run synchronously and without timeouts. |
As far as I can tell, we can't trigger PointerEvents unless the browser supports them natively, so it seems like triggering MouseEvents is the only choice we have, even with pep.js in place.
Thanks, let me know what you find. |
I have been able to make some progress on the issue:
Now I feel like the whole On quirksmode.org I found:
On developer.apple.com it says:
For Safari and iPhone I get quite different values for page and client, as soon as I am not at the top of the page (just as shown here: stackoverflow.com). I feel like I am missing something. I am not quite sure in which direction to head further. Using |
This may be helpful for sorting this out its from the mobile touch events. https://github.com/jquery/jquery-mobile/blob/master/js/events/touch.js#L117-L143 |
Ideally, we'd rewrite draggable before jamming PEP in there. I can't start to look at this soon. |
There is no jamming going on here, there aren't even any draggable changes necessary to make it work with pointer events. I'd much rather see a release with PEP support a few months after 1.12 than a draggable rewrite in another year... |
If we continue to ignore testing on mobile devices, we could just land this asap (after 1.12 is done), since it passes our current browser support and works much much better on various mobile devices. |
We've had a plan to add support for pointer events separately from the interaction rewrites for quite a while now. I'm not sure why the two would need to be intertwined. |
Getting back on:
I noticed that iOS Safari's window.scrollTo(0, -100);
window.pageYOffset; // iOS Safari: -100 - Others: 0
setTimeout(() => window.pageYOffset, 1); // iOS Safari: 0 - Others: 0 For |
Great work digging into that! Reading about Adding timeouts everywhere is hardly a welcome solution (and based on your description, I'm not sure if that's even correct). I wonder if we should instead adjust the tests to drag the element inside the viewport, or at least in a non-negative location (would that help?). @mikesherov any thoughts on this? |
Apologies for the delay. I agree, timeouts should be avoided. I hoped that each asynchronous function call would reset the page offset, but that doesn't seem to be the case (see example). Only with higher timeouts does the page offset go back to 0. : [1,2,3,4,5].forEach(() =>
setTimeout(() => {
window.scrollTo(0, window.pageYOffset - 10);
console.log(window.pageYOffset); // -10, -20, -30, -40, -50
}, 1)
); Iiuc: As soon as one scroll into negative space takes place, the testing environment is off, causing issues for subsequent tests in the suite. Relocating all drags into view would, imho, solve the issue. A number of elements would need to be repositioned such that they do not cause unwanted scrolling during drags (this time in all browsers). Are there specifications on minimum height and width of the viewport, that the tests should run in? |
Feel free to try any values. As long as the fixture isn't visible at the end of the run, it doesn't matter much. Better to have reliable and correct tests with some visual clutter while running the tests. I'm not sure what the iframe size for TestSwarm is, nor what the default dimensions of the browserstack-runner viewport are. I guess 800x600 is pretty safe. |
Got by chance my hands on a Nokia Lumia 950 with Windows 10 Mobile: All draggable demos work well. How do we unit testing browsers with native pointer events support, like IE11, Edge and FF (with flag)? Since PEP is noop'ing out, and we only simulate mouse events, not much is happening. |
Neither sounds particularly attractive to me, but I don't have a better idea either. @scottgonzalez @mikesherov thoughts, ideas? |
I'd say there are really only two viable options:
Both are a fair amount of work. Updating jquery-simulate has a smaller delta though. |
I think using web driver is the right direction moving forward however it is probably more work. |
Resurrects a patch from Marius Stefan Bethge (@bethge), too many intermediate changes prevented even cherry-picks.
Replaces gh-1524
Fixes #4143
Successfully tested all interactions+slider demos on Chrome/OSX, Chrome/Android 5.x, Mobile Safari/iOS 9 Simulator, successfully tested interactions+slider default demos on BrowserStack on IE9/Win7, IE11/Win 8.1, Edge12/Win 10.
TODOs:
Deal with IE8, pep won't load here. Do we just not support it? Adding es5-shim helps, but then we run into other (unrelated) issues, apparently demos/bootstrap.js uses document.head, which IE8 doesn't support. Switching to document.body "works", but then it gets stuck somewhere else. Haven't yet been able to figure out where.We won't support IE8, IE9 and IE10 in 1.13Function#bind
, which is annoying, but easy enough to work around. It also doesn't have MutationObservers, which is a bigger issue (PointerEventsPolyfill: MutationObservers not found, touch-action will not be dynamically detected
). PhantomJS 2.x is still not usable; this seems to be the best issue to follow.Running tests/unit/all.html on Chrome/OSX has failures on dialog and draggable, but both also happen on master. Datepicker and effects tests also had failures on master, but those were easy to fix.Fix for draggable is in Draggable: Fix options tests #1618, can't reproduce dialog issue anymore..simulate( "drag", { dx: 10, dy: 10 } )
call. Part of this is due towindow.scrollTo
behaving differently on iOS, see below.