event.stopPropagation() on a text input inside of a dialog should prevent the dialog from closing
See original GitHub issueI have a <input />
and when I press ESC key, I want to restore the value and blur the input
. The input
is inside of a Dialog
. So I don’t want the dialog to close when i hit ESC on the input. event.stopPropagation()
in onKeyDown
of the button should stop it since it’s a child a Dialog
.
- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
It should not close the dialog
Current Behavior
Steps to Reproduce
Link:
Context
Your Environment
Tech | Version |
---|---|
Material-UI | ^3.3.2 |
React | ^16.6.0 |
Browser | Version 70.0.3538.77 (Official Build) (64-bit) |
TypeScript | Babel |
etc. |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
event.stopPropagation() on a text input inside of a dialog ...
I have a <input /> and when I press ESC key, I want to restore the value and blur the input . The...
Read more >Stop The Dialog From Closing When Clicked - Stack Overflow
I will close this question now, as I have found a solution to this problem. By adding event listener to the dialog itself,...
Read more >How to correctly use preventDefault(), stopPropagation(), or ...
Prevents the event from bubbling up the DOM, but does not stop the browsers default behaviour. For an in-depth explanation of event bubbling,...
Read more >Event.stopPropagation() - Web APIs | MDN
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Read more >stopPropagation() Event Method - W3Schools
The stopPropagation() method prevents propagation of the same event from being called. Propagation means bubbling up to parent elements or capturing down to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am going to take a look at this and see about submitting a 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
event.preventDefault()
andevent.stopPropagation()
and since this behaviour is not documented