File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
polaris-react/src/components/Backdrop Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @shopify/polaris ' : patch
3+ ---
4+
5+ Replaced mouse up and down events on Backdrop with onClick to close Modal
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export function Backdrop(props: BackdropProps) {
2929 }
3030 } ;
3131
32- const handleMouseUp = ( ) => {
32+ const handleClick = ( ) => {
3333 if ( setClosing && onClick ) {
3434 setClosing ( false ) ;
3535 onClick ( ) ;
@@ -41,10 +41,9 @@ export function Backdrop(props: BackdropProps) {
4141 < ScrollLock />
4242 < div
4343 className = { className }
44- onClick = { onClick }
44+ onClick = { handleClick }
4545 onTouchStart = { onTouchStart }
4646 onMouseDown = { handleMouseDown }
47- onMouseUp = { handleMouseUp }
4847 />
4948 </ >
5049 ) ;
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ import {mountWithApp} from 'tests/utilities';
44import { Backdrop } from '..' ;
55
66describe ( '<Backdrop />' , ( ) => {
7- describe ( 'onDismiss ()' , ( ) => {
7+ describe ( 'onClick ()' , ( ) => {
88 it ( 'is called when the backdrop is clicked' , ( ) => {
99 const spy = jest . fn ( ) ;
10- const backdrop = mountWithApp ( < Backdrop onClick = { spy } /> ) ;
11- backdrop . find ( 'div' , { onClick : spy } ) ! . trigger ( 'onClick' ) ;
10+ const backdrop = mountWithApp (
11+ < Backdrop onClick = { spy } setClosing = { ( ) => { } } /> ,
12+ ) ;
13+ backdrop . find ( 'div' ) ! . trigger ( 'onClick' ) ;
1214 expect ( spy ) . toHaveBeenCalled ( ) ;
1315 } ) ;
1416 } ) ;
You can’t perform that action at this time.
0 commit comments