-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(drag-drop): text selection not disabled on safari if user drags out of the viewport #12864
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(drag-drop): text selection not disabled on safari if user drags out of the viewport #12864
Conversation
…ut of the viewport Currently we disable text selection on all draggable elements and their handles, however that doesn't seem to be enough on Safari, because moving your cursor towards the end of the viewport causes the entire body text to be marked. These changes also disable text marking on the entire body while the user is dragging.
FYI drag-drop is now available to use within Google so it's no longer merge-safe |
@@ -133,6 +137,7 @@ export class DragDropRegistry<I, C extends {id: string}> implements OnDestroy { | |||
|
|||
if (this._activeDragInstances.size === 0) { | |||
this._clearGlobalListeners(); | |||
this._document.body.classList.remove('cdk-drag-drop-disable-native-interactions'); |
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.
Will this still get removed if something interrupts the drag? Something like an OS-level prompt or the OS changing window focus/mouse location.
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.
As long as the mouseup/touchend event fires, it will.
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.
That's what I meant- is there any situation where the end event wouldn't fire? I was wondering if there should be something that removed the class if neither a move event nor an end event aren't detected after a certain amount of time
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.
I'd prefer to avoid adding more timers. Even if the user's pointer leaves the browser and then comes back, the next mouseup
/touchend
event will reset it.
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.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently we disable text selection on all draggable elements and their handles, however that doesn't seem to be enough on Safari, because moving your cursor towards the end of the viewport causes the entire body text to be marked. These changes also disable text marking on the entire body while the user is dragging.