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(cdk/drag-drop): don't disable native dragging on inactive handles #20991

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Nov 9, 2020

Currently we disable native drag interactions on handles once when they're registered, however this can block scrolling on mobile devices if the handle is inactive (either it is disabled or the drag element is disabled).

These changes toggle the state dynamically depending on the active state.

Fixes #20974.

Currently we disable native drag interactions on handles once when they're registered,
however this can block scrolling on mobile devices if the handle is inactive (either it
is disabled or the drag element is disabled).

These changes toggle the state dynamically depending on the active state.

Fixes angular#20974.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Nov 9, 2020
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 9, 2020
this._disabledHandles.delete(handle);
if (this._disabledHandles.has(handle)) {
this._disabledHandles.delete(handle);
toggleNativeDragInteractions(handle, this.disabled);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this say false instead of this.disabled?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the handle should stay disabled if it is enabled while the drag item is disabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then should it also use this.disabled in disableHandle? seems odd that the methods aren't mirrored

Copy link
Member Author

Choose a reason for hiding this comment

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

No since disableHandle only disables the handle, not the entire draggable item. A handle is considered "inactive" if either it is disabled or the item is disabled. This might be slightly confusing since toggleNativeDragInteractions(true) means that interactions should be enabled which is true when dragging is disabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I think I understand it, just a little confusing at first sight

Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

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

LGTM

this._disabledHandles.delete(handle);
if (this._disabledHandles.has(handle)) {
this._disabledHandles.delete(handle);
toggleNativeDragInteractions(handle, this.disabled);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I think I understand it, just a little confusing at first sight

@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Nov 10, 2020
@wagnermaciel wagnermaciel merged commit f133210 into angular:master Nov 17, 2020
wagnermaciel pushed a commit that referenced this pull request Nov 17, 2020
…#20991)

Currently we disable native drag interactions on handles once when they're registered,
however this can block scrolling on mobile devices if the handle is inactive (either it
is disabled or the drag element is disabled).

These changes toggle the state dynamically depending on the active state.

Fixes #20974.

(cherry picked from commit f133210)
@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 Dec 18, 2020
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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(drag-drop): scrolling on mobile blocked for disabled drag handle
3 participants