Skip to content

fix(cdk/drag-drop): resolve various event tracking issues inside the shadow dom #23026

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

The drag-drop module depends on a single document-level scroll listener in order to adjust itself when the page or an element is scrolled. The problem is that the events won't be picked up if they come from inside a shadow root.

These changes add some logic to bind an extra event at the shadow root level. Furthermore, they fix several places where we were reading the Event.target while not accounting for shadow DOM.

Fixes #22939.

@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 Jun 20, 2021
@crisbeto crisbeto requested a review from jelbourn June 20, 2021 10:52
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 20, 2021
…shadow dom

The `drag-drop` module depends on a single document-level `scroll` listener in order to adjust itself when the page or an element is scrolled. The problem is that the events won't be picked up if they come from inside a shadow root.

These changes add some logic to bind an extra event at the shadow root level. Furthermore, they fix several places where we were reading the `Event.target` while not accounting for shadow DOM.

Fixes angular#22939.
@crisbeto crisbeto force-pushed the 22939/drag-drop-scroll-tracking-shadow-dom branch from 7d62df1 to f35d9a7 Compare June 20, 2021 11:35
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 the action: merge The PR is ready for merge by the caretaker label Jun 21, 2021
@mmalerba mmalerba merged commit bd08e93 into angular:master Jun 22, 2021
mmalerba pushed a commit that referenced this pull request Jun 22, 2021
…shadow dom (#23026)

The `drag-drop` module depends on a single document-level `scroll` listener in order to adjust itself when the page or an element is scrolled. The problem is that the events won't be picked up if they come from inside a shadow root.

These changes add some logic to bind an extra event at the shadow root level. Furthermore, they fix several places where we were reading the `Event.target` while not accounting for shadow DOM.

Fixes #22939.

(cherry picked from commit bd08e93)
mmalerba pushed a commit that referenced this pull request Jun 22, 2021
…shadow dom (#23026)

The `drag-drop` module depends on a single document-level `scroll` listener in order to adjust itself when the page or an element is scrolled. The problem is that the events won't be picked up if they come from inside a shadow root.

These changes add some logic to bind an extra event at the shadow root level. Furthermore, they fix several places where we were reading the `Event.target` while not accounting for shadow DOM.

Fixes #22939.

(cherry picked from commit bd08e93)
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jun 29, 2021
A recent change (angular#23026) appears to have introduced flakiness in our unit tests on Firefox. These changes apply a similar workaround to some of the other scrolling tests.
amysorto pushed a commit that referenced this pull request Jun 29, 2021
A recent change (#23026) appears to have introduced flakiness in our unit tests on Firefox. These changes apply a similar workaround to some of the other scrolling tests.
amysorto pushed a commit that referenced this pull request Jun 29, 2021
A recent change (#23026) appears to have introduced flakiness in our unit tests on Firefox. These changes apply a similar workaround to some of the other scrolling tests.

(cherry picked from commit 49d0ccc)
@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 Jul 23, 2021
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(Scrolling,DragDrop): Dragging with scrolling dont work as expected when placed inside ViewEncapsulation.ShadowDom container
3 participants