File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,16 @@ export function ConfirmButton(props: {
19
19
const [ clicked , setClicked ] = useState ( false ) ;
20
20
const [ confirmed , setConfirmed ] = useState ( false ) ;
21
21
22
+ // For Safari compatibility, also apply this to the "mouseDown" event, since the
23
+ // "click" event doesn't fire when the user clicks or taps on a button made visible
24
+ // in this way
25
+ const clickHandler = ( e : any ) => {
26
+ props . onConfirm ( ) ;
27
+ if ( props . remainAfterConfirmation ) {
28
+ setConfirmed ( true ) ;
29
+ }
30
+ } ;
31
+
22
32
return (
23
33
< Box sx = { { width : '6em' } } >
24
34
{ clicked ? (
@@ -29,12 +39,8 @@ export function ConfirmButton(props: {
29
39
variant = "contained"
30
40
color = "error"
31
41
title = { props . name }
32
- onClick = { _ => {
33
- props . onConfirm ( ) ;
34
- if ( props . remainAfterConfirmation ) {
35
- setConfirmed ( true ) ;
36
- }
37
- } }
42
+ onClick = { clickHandler }
43
+ onMouseDown = { clickHandler }
38
44
onBlur = { _ => setClicked ( false ) }
39
45
style = { { visibility : clicked ? 'visible' : 'hidden' } }
40
46
autoFocus
You can’t perform that action at this time.
0 commit comments