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(drag-drop): handle list and viewport auto scroll regions overlapping #16675

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Aug 3, 2019

The way auto-scrolling is currently set up is that we have regions that are X% of the width/height of a node and whenever the user's pointer gets into the region, we start scrolling either the element or the page. It looks something like this where red are the regions of the list and green are the ones of the page:

Angular_Material_-_Google_Chrome_2019-08-03_10-58-51

The problem with our current approach is that as soon we find that the user's pointer is in one node's scroll regions, we disregard any of the other scroll regions and we start scrolling, even if the element can't actually scroll. This is problematic in cases where the scroll list might be close to the viewport's edge and thus it could have its region overlapping with the viewport's. These changes address the issue in two ways:

  1. We have the list's scroll regions take precedence over the ones of the page.
  2. If the regions overlap, we check whether the element can continue scrolling that direction and if it can't, we start scrolling the page.

Fixes #16647.

@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 Aug 3, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 3, 2019
The way auto-scrolling is currently set up is that we have regions that are X% of the width/height of a node and whenever the user's pointer gets into the region, we start scrolling either the element or the page. The problem with our current approach is that as soon we find that the user's pointer is in one node's scroll region, we disregard any of the other scroll regions and we start scrolling, even if the element can't actually scroll. This is problematic in cases where the scroll list might be close to the viewport's edge and thus it could have its region overlapping with the viewport's. These changes address the issue in two ways:

1. We have the list's scroll regions take precedence over the ones of the page.
2. If the regions overlap, we check whether the element can continue scrolling that direction and if it can't, we start scrolling the page.

Fixes angular#16647.
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


/**
* Gets the directions in which an element node should be scrolled,
* assuming that the user's pointer is already within it scrollable region.
Copy link
Member

Choose a reason for hiding this comment

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

"within it scrollable region" -> "within its scrollable region" ?

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Aug 21, 2019
@angular angular deleted a comment from shyamal890 Aug 27, 2019
@jelbourn jelbourn merged commit 792e886 into angular:master Aug 27, 2019
mmalerba pushed a commit to mmalerba/components that referenced this pull request Aug 27, 2019
…ing (angular#16675)

The way auto-scrolling is currently set up is that we have regions that are X% of the width/height of a node and whenever the user's pointer gets into the region, we start scrolling either the element or the page. The problem with our current approach is that as soon we find that the user's pointer is in one node's scroll region, we disregard any of the other scroll regions and we start scrolling, even if the element can't actually scroll. This is problematic in cases where the scroll list might be close to the viewport's edge and thus it could have its region overlapping with the viewport's. These changes address the issue in two ways:

1. We have the list's scroll regions take precedence over the ones of the page.
2. If the regions overlap, we check whether the element can continue scrolling that direction and if it can't, we start scrolling the page.

Fixes angular#16647.
@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 27, 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 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.

Inconsistencies with cdkDropListAutoScroll
3 participants