-
Notifications
You must be signed in to change notification settings - Fork 841
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
Focus trap requires two clicks when focus is on EuiSelect #3190
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3190/ |
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.
Seems like this change will work.
The original reason for preventing propagation was that state updates that triggered rerenders could effectively reset/clear input value changes.
Preventing parent-only propagation would theoretically be enough, but I'll do some more testing to verify
Went back to the source (#1926):
So, at the time, it was known that we'd find ourselves in this position. Unfortunately, I did not happen to write comments for why |
Unfortunately, using |
Ah, you are correct. I had tested in Chrome yesterday 😞 @ashikmeerankutty if you replace the export in export default class extends Component {
options = [
{ value: 'option_one', text: 'Option one' },
{ value: 'option_two', text: 'Option two' },
{ value: 'option_three', text: 'Option three' },
];
state = { val: this.options[1].value, otherKey: 0 };
onChange = e => {
this.setState({
val: e.target.value,
});
};
render() {
return (
<div>
<EuiOutsideClickDetector
onOutsideClick={() => {
this.setState({ otherKey: this.state.otherKey + 1 });
}}>
<h1>Counter {this.state.otherKey}</h1>
</EuiOutsideClickDetector>
<EuiSelect
options={this.options}
value={this.state.val}
onChange={this.onChange}
/>
</div>
);
} |
@thompsongl Thanks for the review. I had a strong feeling that my change will break something. I will check if some other fix exists. |
Summary
Possible Fix for #3172
This issue was due to
stopImmediatePropagation
that prevents any parent handlers and also any other handlers from executing. So the closePopover was not executed. The possible fix was to usestopPropogation
instead ofstopImmediatePropagation
so that only the parent handlers are prevented.This fixes the issue in firefox and chrome but doesn't fix the issue in safari. This behavior is better than the current behavior.
- [ ] Props have proper autodocs- [ ] Added documentation examples- [ ] Added or updated jest tests- [ ] Checked for accessibility including keyboard-only and screenreader modes