onCancel not being called for modals
See original GitHub issueEnvironment(required)
- antd version: 2.7.4
- OS and its version: Windows 10
- Browser and its version: chrome 56.0.2924.87
What did you do? Please provide steps to re-produce your problem.
Modal.confirm({
title: 'Sample title',
content: `Sample content`,
onCancel: () => console.log('cancelling') });
What do you expected?
a console log when pressing ESC key
What happens?
The modal closes but the log is not printed
Re-producible online demo
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Bootstrap close modal not working - Stack Overflow
The first is the close icon and the other one is cancel button, both use data-dismiss to close the modal. However, both of...
Read more >Cancel on modal confirmation dialog not working
Override the PreSaveAction in order to cancel the save. function PreSaveAction() { if (confirm("Confirmez-vous ce choix de réforme ?
Read more >Modal - Ant Design
Asynchronously close a modal dialog when the OK button is pressed. ... Let onCancel/onOk function return a promise object to delay closing the...
Read more >Cancel a React Modal with Escape Key or External Click
The useEffect automatically calls our returned cleanup function when the useEffect dismounts. Thanks! We're not quite there yet, though. We need ...
Read more >Modals manager | Mantine
children – additional modal content displayed before actions; onCancel – called when cancel button is clicked; onConfirm – called when confirm button is...
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
Hi elios.I think it’s not a bug,because the doc say that
onCancel
don’t care aboutesc
,it just handlecancel button and x button
.And I think maybe it’s brower’s behavior(i.e.,remove all nodes which are masks ),you can usealert()
orconfirm()
on the browser console and then press “Esc” key,you will see that they will disappear.Maybe these help?
Five unexpected uses for the Esc key
bootstrap modal handle esc
bootstrap modal doc
relevant issue1
relevant issue2
relevant issue3
Chrome keyboard shortcuts
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.