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

fix(select): close select on menu close #4889

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Sep 10, 2023

There are some situations where the menu can close when the outer select is still open and unaware.

For example, clicking the field will open the menu, then clicking it again will close the menu but not the select.

This is because the menu observes outside clicks in order to close itself. We don't currently observe those closes to update our own state inside md-select, so the UI still shows as if it is open but without a menu.

The fix here is to always reflect the state of the menu on closed.

Example of this bug:

  • Go here
  • Click the select box
  • Click it again
  • Observe that it thinks it is still open (e.g. the arrow is pointing the wrong way)

@43081j 43081j changed the title fix (select): close select on menu close fix(select): close select on menu close Sep 10, 2023
@@ -48,6 +51,18 @@ export class SelectHarness extends Harness<Select> {
field.click();
}

async clickAndWaitForMenu() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we override click() and wait for the menu's events there? I'm not sure when you'd want to click the element and not wait for all the events to settle.

select/internal/select.ts Outdated Show resolved Hide resolved
There are some situations where the menu can close when the outer select
is still open and unaware.

For example, clicking the field will open the menu, then clicking it
again will close the menu **but not the select**.

This is because the menu observes outside clicks in order to close
itself. We don't currently observe those closes to update our own state
inside `md-select`, so the UI still shows as if it is open but without a
menu.

The fix here is to always reflect the state of the menu on `closed`.
@43081j 43081j force-pushed the select-clicks branch 2 times, most recently from 76537b0 to 58bea9c Compare February 26, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants