material icon indicating copy to clipboard operation
material copied to clipboard

autocomplete: dropdown detaches on scroll when inside $mdDialog

Open papb opened this issue 6 years ago • 7 comments

Bug

CodePen and steps to reproduce the issue:

CodePen which demonstrates the issue: YJZyyE

Detailed Reproduction Steps:

GIF showing issue

  1. Open the md-dialog
  2. Click on the autocomplete, so that the dropdown appears
  3. Scroll the page

What is the expected behavior?

Either the scroll should be disabled (which is the default behavior when the md-autocomplete is not inside a md-dialog), or the scroll should happen but with the dropdown not detaching.

What is the current behavior?

The scroll happens with the dropdown menu detaching itself from the autocomplete field.

What is the use-case or motivation for changing an existing behavior?

This is bad UX

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.6.9
  • AngularJS Material: 1.1.10
  • OS: Tested in Windows
  • Browsers: Tested in Chrome

papb avatar Oct 09 '18 17:10 papb

From the Material Design spec on Dialogs:

Dialogs should avoid:

  • Containing scrolling content

That said, we should probably still support this case. It looks like the problem is in $mdUtil.disableScrollAround(). Basically the md-dialog opens first and disables scroll on the body. Then when the md-autocomplete opens, it tries to disable scroll on the md-dialog-content but that doesn't work properly since it is shortcut by the following: https://github.com/angular/material/blob/ca10bd0b2e12d9244e3e6741b8f8d3600f081d39/src/core/util/util.js#L225-L227

This causes the second call's parent to never have scrolling disabled.

Splaktar avatar Nov 06 '18 22:11 Splaktar

I'm also facing the same issue. When this issue will be fixed ?

Suvarnni avatar Jan 28 '19 06:01 Suvarnni

@Suvarnni after most of the P1 and P2 issues are fixed or a community member submits a PR to fix it. Though I will warn that this would be one of the more challenging issues for a community member to fix.

That said, if you want to investigate and provide detailed feedback and ideas towards a fix, it would help move this faster.

Splaktar avatar May 10 '19 19:05 Splaktar

This is a major UX problem. Any solution/workarounds for this is highly appreciated.

stagefright5 avatar Aug 26 '19 07:08 stagefright5

+1 Waiting for the Fix

Byloor avatar Sep 20 '19 09:09 Byloor

+1 Waiting for a fix or a workaround

msd117 avatar Dec 04 '19 12:12 msd117

A fix would be awesome!

NZhuravlev avatar Feb 04 '21 12:02 NZhuravlev