File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ function CustomColorCell(props: ColorCellProps) {
122122 const colorInput = useRef < HTMLInputElement > ( null ) ;
123123 const colorInputDebouncer = useRef < Debouncer < string | null > | null > ( null ) ;
124124 const callbackRef = useRef ( props . onSelect ) ;
125+ const isSafari = useRef ( / ^ ( (? ! c h r o m e | a n d r o i d ) .) * s a f a r i / i. test ( navigator . userAgent ) ) ;
125126
126127 useEffect ( ( ) => {
127128 colorInputDebouncer . current = new Debouncer ( 500 , ( color ) => {
@@ -152,7 +153,12 @@ function CustomColorCell(props: ColorCellProps) {
152153 colorInput . current ?. click ( ) ;
153154 } , [ pickedColor ] ) ;
154155
155- return < div style = { `--foreground: ${ getForegroundColor ( props . color ) } ;` } >
156+ return < div style = { `--foreground: ${ getForegroundColor ( props . color ) } ;` }
157+ onClick = { ( e ) => {
158+ // The color picker dropdown will close on Safari if the parent context menu is
159+ // dismissed, so stop the click propagation to prevent dismissing the menu.
160+ isSafari . current && e . stopPropagation ( ) ;
161+ } } >
156162 < ColorCell { ...props }
157163 color = { pickedColor }
158164 className = { clsx ( "custom-color-cell" , {
You can’t perform that action at this time.
0 commit comments