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

Dropdown Menu-Triggered Modal Input Doesn't Allow Space #3854

Closed
redsky17 opened this issue Dec 4, 2019 · 3 comments
Closed

Dropdown Menu-Triggered Modal Input Doesn't Allow Space #3854

redsky17 opened this issue Dec 4, 2019 · 3 comments
Labels

Comments

@redsky17
Copy link

redsky17 commented Dec 4, 2019

Bug Report

User cannot enter space on input that is on a control triggered from the Dropdown.

This bug seems similar to #3768 but my use-case is different (I'm not using the Input directly as a trigger to the Dropdown itself).

This is still an issue in Semantic UI React 0.88.1, so it seems the fix documented in PR #3766 doesn't fix this particular issue.

I have tried to create a new Dropdown that extends the regular Dropdown and overrides the openOnSpace function as described here: #2229

That almost works, but the result is that the first time a user enters a 'space' for any given Input, the space key is ignored. Subsequent spaces work as expected on the Input.

Steps

Create a Dropdown component with a Dropdown.Menu. Inside of the Dropdown.Menu, place a Modal with a trigger as a Dropdown.Item. Inside of the Modal is a Form with Form.Input. The user will not be able to press the Space bar when typing inside of the Input. Instead, the Dropdown will open and close from behind the modal.

Setting autoFocus on the input almost seems to fix it, but if you have multiple Inputs in the Modal, switching between them causes the spacebar issue to re-appear. It seems as though the Dropdown steals focus from the modal somehow.

Here is a CodeSandbox with a minimum example showcasing the issue:
https://codesandbox.io/s/semantic-ui-example-wqyf1

Expected Result

User can enter text freely in the Input without triggering the Dropdown.

Actual Result

Dropdown opens and closes when the user presses space inside of the Input

Version

0.88.1

Testcase:

https://codesandbox.io/s/semantic-ui-example-wqyf1

@welcome
Copy link

welcome bot commented Dec 4, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@redsky17
Copy link
Author

redsky17 commented Dec 4, 2019

This might be a duplicate of #3689. I'll give the suggestion in the comments of that issue a shot and report back.

@redsky17
Copy link
Author

redsky17 commented Dec 4, 2019

The workaround documented in #3689 works, so I'm closing this as a dupe.

@redsky17 redsky17 closed this as completed Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant