-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Windows 8 Touch Support #1152
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
Windows 8 Touch Support #1152
Conversation
For draggable and sortable this isn't ideal as it applies Currently the |
.ui-draggable { | ||
-ms-touch-action: none; | ||
touch-action: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at EOF.
Oh boy. Our CSS linter don't know about |
Ping @georgestephanis who pinged me about this earlier. |
Even the most recent version (0.2.0) of the linter has this issue. |
Yup. I'd maybe rather see this set in JS rather than CSS, as that way it won't necessarily clutter up non-IE browsers. WordPress Core had initially dealt with this here: http://core.trac.wordpress.org/ticket/22583 and then refined it to the handles here: http://core.trac.wordpress.org/ticket/26297 It's easy to hit in JS, though -- if ( typeof el.style.msTouchAction != 'undefined' ) el.style.msTouchAction = "none"; -- and that would just need to be on the elements that the dragging should activate on -- either the full element or just the handle. If there's not a good class applied, this is probably easier than adding a new class just for IE 10/11 Touch? |
The JS above may need to switch and also do if ( typeof el.style.touchAction != 'undefined' ) el.style.touchAction = "none"; to handle the unprefixed version. |
Well, it's not just going to be IE 10/11 touch, it's presumably going to be all browsers (potentially sans Safari) at some point. |
I suppose if it's only affecting touch devices right now that might mean that this will continue to only be touch devices in the future, but it should certainly apply to more browsers in the future. Blink is actively working on this, so that would include Chrome and Opera. I think Firefox is working on this already, but at a minimum it's planned. Apple hasn't expressed any interest in Pointer Events, but members of the Blink team are trying to get touch action into Touch Events for WebKit, so this could affect Safari too at some point. |
True. I'd be fine with either resolution -- if it's adding new stylesheets, though, we'd definitely need to add some classes to target specifically, like... .ui-draggable .ui-item,
.ui-sortable .ui-item {
-ms-touch-action: none;
touch-action: none;
}
.ui-with-handles .ui-item {
-ms-touch-action: auto;
touch-action: auto;
}
.ui-with-handles .ui-handle {
-ms-touch-action: none;
touch-action: none;
} as if we set it on the entire containing element, then it can nerf the user's ability to drag the page on the touch device if they're touching anywhere in the containing element -- even if not on an item in it. |
The reason I prefer a class name is it makes it far easier to clean up in Maybe we can use something generic like |
Not really. As long as there's a |
Ah ok. I don't think I'll get a good sense for which of these approaches is going to work best without trying them out. I'll play around this weekend and see what I can come up with. |
I just pushed the best I could come up with. I also started the process to get our linter to recognize |
https://github.com/nzakas/parser-lib/ was updated so |
@@ -296,6 +304,18 @@ $.widget("ui.draggable", $.ui.mouse, { | |||
true; | |||
}, | |||
|
|||
_setHandleClassName: function() { | |||
this._removeHandleClassName(); | |||
$( this.options.handle ? this.options.handle : this.element ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.options.handle || this.element
It looks like sortable still needs to handle new items being introduced via |
All changes have been made. Good catch on |
Just some minor changes and we're good to go. @georgestephanis Does this look good to you? |
Looks reasonable from a quick skim, I've explicitly loaded/tested it yet though. I'm going to try spinning it up over the weekend to confirm everything's running well. |
I didn't mean to close the pull request; I hit the wrong button. o_O @scottgonzalez The final few changes have been made. @georgestephanis Thanks for trying this out. You'll have to let us know how it goes. Assuming all is well I'll land this. |
@georgestephanis Did you get a chance to test this over the weekend? |
Just verified, and everything seems to be operating correctly from what I can tell. 👍 |
Made a ticket in WordPress trac to drop our polyfill for this once it gets merged in. |
Thanks for your help @georgestephanis. This is now merged into master and will go out with 1.11. |
No description provided.