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

bug(mat-select): Option overlay is misaligned if 'disableOptionCentering' is true and selected/first option is under an options group #21570

Closed
koccs opened this issue Jan 13, 2021 · 1 comment · Fixed by #21716
Labels
area: material/select P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@koccs
Copy link
Contributor

koccs commented Jan 13, 2021

Reproduction

Example: https://stackblitz.com/edit/angular-vzpglv

Steps to reproduce:

  1. Create a mat-select with enabled disableOptionCentering
  2. Add options with option groups
  3. Select one of the options under a group (if the first one is not under a group)
  4. Open options again
  5. The options overlay is misaligned to the left (in ltr) because of the SELECT_PANEL_INDENT_PADDING_X here: https://github.com/angular/components/blob/master/src/material/select/select.ts#L1287

Expected Behavior

If the disableOptionCentering is turned on then the _calculateOverlayOffsetX() method should use the SELECT_PANEL_PADDING_X even if the first/selected option is under a group.

Actual Behavior

_calculateOverlayOffsetX() method uses the SELECT_PANEL_INDENT_PADDING_X every time if the first/selected option is under a group.

Environment

  • Angular: 10, 11
  • CDK/Material: 10, 11
  • Browser(s): Chrome 87, Firefox 84
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS, Windows

This seems easy to fix with and additional condition in the _calculateOverlayOffsetX() like if(this.multiple). If you guys agree with my assumptions I would like to fix it.

@koccs koccs added the needs triage This issue needs to be triaged by the team label Jan 13, 2021
@crisbeto crisbeto added area: material/select Fixed in MDC P4 A relatively minor issue that is not relevant to core functions and removed needs triage This issue needs to be triaged by the team labels Jan 18, 2021
koccs added a commit to koccs/components that referenced this issue Jan 27, 2021
…centering

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes angular#21570
koccs added a commit to koccs/components that referenced this issue Jan 27, 2021
…centering

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes angular#21570
koccs added a commit to koccs/components that referenced this issue Jan 27, 2021
…centering

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes angular#21570
koccs added a commit to koccs/components that referenced this issue Jan 27, 2021
…centering

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes angular#21570
@crisbeto crisbeto added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed P4 A relatively minor issue that is not relevant to core functions labels Jan 27, 2021
wagnermaciel pushed a commit that referenced this issue Feb 1, 2021
…centering (#21716)

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes #21570
wagnermaciel pushed a commit that referenced this issue Feb 1, 2021
…centering (#21716)

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes #21570

(cherry picked from commit da1f7e7)
wagnermaciel pushed a commit to wagnermaciel/components that referenced this issue Feb 8, 2021
…centering (angular#21716)

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes angular#21570
wagnermaciel pushed a commit to wagnermaciel/components that referenced this issue Feb 8, 2021
…centering (angular#21716)

Fixes a the overlay offset calculation for grouped option values if disableOptionCentering is true.
The overlay should not have double offset value for any selected option to keep it under the
trigger element.

Fixes angular#21570
@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 Mar 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/select P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants