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

Combo box blows up when in a modal #1195

Closed
bevacqua opened this issue Sep 14, 2018 · 3 comments · Fixed by #1258
Closed

Combo box blows up when in a modal #1195

bevacqua opened this issue Sep 14, 2018 · 3 comments · Fixed by #1258
Assignees
Labels

Comments

@bevacqua
Copy link
Contributor

Clicking options in the combo list results in an infinite loop, but strangely only when the combo is in a modal box

screen shot 2018-09-14 at 17 33 20

@bevacqua bevacqua added the bug label Sep 14, 2018
@chandlerprall chandlerprall self-assigned this Sep 14, 2018
@chandlerprall
Copy link
Contributor

Related to #1051 ; in this case the modal wraps its contents with a FocusTrap, and the combo box's option list renders through an EuiPortal outside the modal's div, and tries to focus the option list on click. The focus trap sees the focusing of an outside element and fights back.

@chandlerprall
Copy link
Contributor

Full story:

React & FocusTrap have a focus event listener. When the combo box has an active element it sets focus to that option in its componentDidUpdate. The call to .focus() the element triggers its onFocus handler which gets scheduled through react's event batching. Then the FocusTrap handler executes, preventing the element from receiving focus (it's outside the modal trap, see above comment). When the scheduled batched event fires, it sees that the option is not selected and calls .focus() on it, triggering the whole cycle again.

@chandlerprall
Copy link
Contributor

We can resolve this issue by refactoring EuiComboBox to retain focus instead of shifting it to the options list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants