-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
event.stopPropagation() on a text input inside of a dialog should prevent the dialog from closing #13470
Comments
@stevemao This should already be taken care of by our component:
Bootstrap and react-modal are not event checking it. I doubt we can do anything about it. Do you have a reproduction example? Why don't you preventDefault or stop the event propagation on the keydown? |
I could do |
@stevemao You are right, it sounds like a good path forward. Do you want to try? :) |
Yeah sure :) but no timeframe promised :) |
Just to be sure. This will be a breaking change. |
How is this a breaking change? It's should definitely not be released in a patch.
What do you mean by it's not a default browser behavior? |
For those who call For those who call |
@stevemao This makes a lot of sense. One could argue the opposite, I think that it's a matter of interpretation of what a default behavior is and if it can extend to non-native elements. However, considering none of the two implementations I have linked do it, I'm happy to remove this logic. I have also notice that Bootstrap calls prevent default after handling the escape event while react-modal calls stop propagation. I know that reactstrap and react-overlay does nothing about it. We might want to arbitrate on that point. What do you think? Do you think we should release that change in tha minor or a major? It can be considered a bug fix. |
Yeah 👍
If you are paranoid/conservative (which is what a lot of people do nowadays) then it it'll be a major. But I doubt if a lot of people are using |
I am going to take a look at this and see about submitting a fix. |
I have a
<input />
and when I press ESC key, I want to restore the value and blur theinput
. Theinput
is inside of aDialog
. So I don't want the dialog to close when i hit ESC on the input.event.stopPropagation()
inonKeyDown
of the button should stop it since it's a child aDialog
.Expected Behavior
It should not close the dialog
Current Behavior
Steps to Reproduce
Link:
Context
Your Environment
The text was updated successfully, but these errors were encountered: