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

Pressing "ESC" key doesn't close the modal when the focus is on a search select inside the modal #48520

Open
eliasinho opened this issue Apr 17, 2024 · 4 comments

Comments

@eliasinho
Copy link

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  • Click the "Open modal" button in the reproduction sandbox
  • Click in the search input inside the modal, so that is has the focus
  • Press the keyboard ESC key

What is expected?

The modal closes.

What is actually happening?

The modal stays open.

Environment Info
antd undefined
React 18.2.0
System Windows 10 Pro
Browser Firefox 124.0.2
@wanpan11
Copy link
Contributor

wanpan11 commented Apr 18, 2024

Select open=true
prioritize closing Select and stop event bubbling

image

@eliasinho
Copy link
Author

@wanpan11 thanks for your quick answer. I don't understand though, are suggesting a potential solution, or just explaining why it doesn't work?

@wanpan11
Copy link
Contributor

@wanpan11 thanks for your quick answer. I don't understand though, are suggesting a potential solution, or just explaining why it doesn't work?

🤣🤣🤣🤣
Select the component and listen to the ESC event at the same time. When open=true, the pop-up window of the selected component will be closed first. In the demo, open is always equal to true, causing the ESC event to fail to bubble up to the Modal component and thus cannot be closed.

@korkt-kim
Copy link
Contributor

korkt-kim commented Apr 18, 2024

I think this is not bug to fix. There would be some circumstances that pressing esc does other action except closing modal (like clearing inputs in focused input component)

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

No branches or pull requests

3 participants