File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
components/dashboard/src/components Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,10 @@ export default function ConfirmationModal(props: {
43
43
child . push ( props . children ) ;
44
44
}
45
45
}
46
+ const cancelButtonRef = useRef < HTMLButtonElement > ( null ) ;
46
47
47
48
const buttons = [
48
- < button className = "secondary" onClick = { props . onClose } autoFocus > Cancel</ button > ,
49
+ < button className = "secondary" onClick = { props . onClose } autoFocus ref = { cancelButtonRef } > Cancel</ button > ,
49
50
< button className = "ml-2 danger" onClick = { props . onConfirm } disabled = { props . buttonDisabled } >
50
51
{ props . buttonText || "Yes, I'm Sure" }
51
52
</ button > ,
@@ -63,6 +64,10 @@ export default function ConfirmationModal(props: {
63
64
visible = { props . visible === undefined ? true : props . visible }
64
65
onClose = { props . onClose }
65
66
onEnter = { ( ) => {
67
+ if ( cancelButtonRef ?. current ?. contains ( document . activeElement ) ) {
68
+ props . onClose ( ) ;
69
+ return false ;
70
+ }
66
71
if ( buttonDisabled . current ) {
67
72
return false
68
73
}
You can’t perform that action at this time.
0 commit comments