-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Select] Simplify blur logic #17299
[Select] Simplify blur logic #17299
Conversation
Details of bundle changes.Comparing: 40fad15...9cd829b
|
onClick={disabled || readOnly ? null : handleClick} | ||
/* prevent focusing the trigger since we'll open anyway and move focus */ | ||
onMouseDown={e => e.preventDefault()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise the trigger gets focused applying styles that are immediately removed because we focus an option in the listbox i.e. what the comment says 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to display the select in active state since this is closer to the native select but does not follow WAI-ARIA.
3be538d
to
de48b3f
Compare
de48b3f
to
236a94b
Compare
expect(container.querySelector('[for="age-simple"]')).to.have.class('focused-label'); | ||
}); | ||
|
||
it('does not stays in an active state if an open action did not actually open', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually breaks on master confirming what we see in #17294
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
The trigger isn't focused anymore. So far nobody complained so I guess this is ok to keep.
What do you mean by nobody complained? I fail to see the behavior you refer to.
Does the non-native behavior differs from the native one?
That is outdated. I was originally following the WAI-ARIA practices but decided to keep the old implementation (which is closer to the native select). |
Well done! |
Closes #17294
The previous implementation assumed that the open actions would actually open the select. The issue however illustrated a case where this assumption didn't hold which caused a broken looking UI (which could be restore by bluring manually).
The overall problem is that using InputBase is the wrong abstraction. We're abusing the focused state of the input to display the select as active. The trigger isn't focused anymore. So far nobody complained so I guess this is ok to keep. Just something we need to keep in mind.