Skip to content

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

Merged

Conversation

crisbeto
Copy link
Member

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.

…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.
@crisbeto crisbeto added pr: merge safe target: major This PR is targeted for the next major release labels Aug 28, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 28, 2018
@jelbourn
Copy link
Member

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');
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Aug 31, 2018
@jelbourn jelbourn merged commit 8ee5fb6 into angular:master Sep 11, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants