Overlay-based components should handle page scroll gracefully
Creating this issue to track this problem for menu, tooltip, select, autocomplete, datepicker, dialog, snackbar.
Approach we will be taking:
- Default behavior will be to reposition the overlay on scroll using the
ScrollDispatcher - Behavior can be changed to disable scrolling instead on a strictly opt-in basis
- Implementation of scroll-blocking must be overridable by end-user
Auto complete overlayed dropdown position is not updated on scroll.
Autocomplete does support repositioning upon resize / scroll. But not when dropdown list items change and there by height of dropdown. Also why is the position dependent on height of dropdown? it can be accommodated above/below just based on availability of space? Or is there a priority to show it below?
Consider a case where one option is already entered("png-alpha" in screenshot). Now when focus is back in the input there is just enough space below the control to show one option(already selected one) and it fits in.
Figure 1: single item accommodated in just-enough-space
But if we delete couple of characters from the input text, more options showup but doesn't update position to above neither does it allow to scroll beyond document height.
Figure 2: broadening search critereon brings in more items but not accessible via scroll/neither does it reposition
If I do a scroll or blur/focus-back the repositioning is triggered correctly, but not upon change in "input text" or "dropdown-list" length.
_Figure 3: clicking out to blur and focusing in back fixes the issue and triggers repositioning _
This can be fixed by either of the following in my opinion: 1. Updating position when input text changes along with scroll, which might eat up performance. 2. Make position(above/below) irrespective of height of dropdown and only based on proximity of input element to screen edges. This way figure 1 should show the options above irrespective of the fact that it can be accommodated below.
using master "@angular/material": "git+https://github.com/angular/material2-builds.git"
https://github.com/angular/material2/pull/4469 will reposition the autocomplete panel when the amount of items changes.
@crisbeto @jelbourn Isn't this fix merged in the latest beta version(2.0.0-beta.5). It works in the example provided. Still my autocomplete options scrolls with the page.
If not please let me know, how to include those changes.
Thanks, Sudheesh
@sudheeshcm Are you in this case : https://github.com/angular/material2/issues/4557 ?
@Zefling I'm not exactly sure. Tried removing all the "overflow: auto" styles, and still have this issue.
Datepicker seems to be in a fixed position and does not stay in same position when scrolling away from input. This may be intentional to keep the user from scrolling away before making a choice but if you have a datepicker near the bottom of a page then part of the datepicker will be hidden.
There's a pending PR (https://github.com/angular/material2/pull/4696) that adds positioning improvements to the datepicker.
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.