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

Feature request, Autocomplete: Defer calculation of width until actually showing dropdown #4146

Closed
wulfsberg opened this issue Apr 18, 2017 · 1 comment · Fixed by #4346
Closed
Assignees

Comments

@wulfsberg
Copy link

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

The width of the dropdown is based on the width of the input field when the dropdown is shown.

What is the current behavior?

The width of the dropdown is based on the width of the input field when the field gains focus.

What are the steps to reproduce?

This plunkr simulates a search box which takes up less space until actually in use:
http://plnkr.co/edit/JqeCALpdEQtp1CytTU3k?p=preview

  • Click in the search field to focus and expand it.
  • Type something.

Notice: The dropdown is only as wide as the search field was before expanding.

  • Leave some text in the field and click outside it. The field keeps its size (due to a CSS class set when it contains a value).
  • Click back in the search field.

Notice: The dropdown is now as wide as the input field.

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

Being able to dynamically resize the input field when used as a floating "widget" over a map interface, yielding as much screen estate to the map as possible when the input field is not in active use by the user.

Which versions of Angular, Material, OS, browsers are affected?

Angular 4.0.1, Material2 beta.3

Is there anything else we should know?

If the width is set without a transition, the calculation picks up the new width. I am not sure if there is any specification of the timing of events vs CSS layout, but I suspect this is an arbitrary race which the CSS just happens to win.

@crisbeto crisbeto added the has pr label May 1, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue May 1, 2017
Fixes the autocomplete panel not being resized while it is open. It was due to it recalculating the width, but not calling `overlayRef.updateSize`.

Fixes angular#4146.
@kara kara closed this as completed in #4346 May 9, 2017
@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants