components icon indicating copy to clipboard operation
components copied to clipboard

Autocomplete closes when scrolling on a touch device

Open csidorenko opened this issue 7 years ago • 2 comments

Steps to reproduce:

  1. Open https://material.angular.io/components/autocomplete/overview in any touch device
  2. Use the example on the page, tap to show autocomplete
  3. If it was a longer list or you're viewing on a small device you would want to scroll to see the rest of the list. Scroll with touch.
  4. On touchend the autocomplete closes

Expected Behavior

It is the intended behavior according to the code in autcomplete.es5.js L:601

return merge(fromEvent(this._document, 'click'), fromEvent(this._document, 'touchend'))`
    .pipe(filter(function (event) {
            /** @type {?} */
            var clickTarget = (/** @type {?} */ (event.target));
            /** @type {?} */
            var formField = _this._formField ?
                _this._formField._elementRef.nativeElement : null;
            return _this._overlayAttached &&
                clickTarget !== _this._element.nativeElement &&
                (!formField || !formField.contains(clickTarget)) &&
                (!!_this._overlayRef && !_this._overlayRef.overlayElement.contains(clickTarget));
        }));

The menu closes on touchend but I think it's a bug because it's normal to expect users to scroll on a mobile device to see the rest of the list. I think the fromEvent(this._document, 'touchend') should be removed or the code changed to allow scrolling

Environment

  • Angular: 7.2.13
  • CDK/Material: 7.3.7
  • Browser(s): All browsers on a touch device
  • Operating System (e.g. Windows, macOS, Ubuntu): All operating systems that support touch

csidorenko avatar Sep 10 '19 20:09 csidorenko

We are closing this issue, because we've determined, using a semi-automated process, that it is no longer relevant, has low engagement, or it does not have enough information to proceed. Feel free to comment if you think the issue should be reopened, or open a new issue with the latest version of our code instead.

crisbeto avatar May 29 '26 12:05 crisbeto

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.