Skip to content

Autocomplete panel should base width on input-container, not input #4914

@willshowell

Description

@willshowell

Bug, feature request, or proposal:

Bug

Expected

The autocomplete panel does not change its width when the input resizes, only when the input container does.

Current

The autocomplete panel resizes when an mdSuffix is rendered, thus changing the size of the actual input.

Reproduction

https://plnkr.co/edit/VrcrcUBKbwuoOoxc8byM?p=preview

Motivation

Using a "clear input" button on an autocomplete input

Proposed change

/** Returns the width of the input element, so the panel width can match it. */
private _getHostWidth(): number {
-  return this._element.nativeElement.getBoundingClientRect().width;
+  return this._inputContainer
+    ? this._inputContainer._elementRef.nativeElement.getBoundingClientRect().width
+    : this._element.nativeElement.getBoundingClientRect().width;
}

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions