@@ -432,6 +432,48 @@ describe('vaadin-app-layout', () => {
432432 expect ( event . defaultPrevented ) . to . be . true ;
433433 } ) ;
434434
435+ it ( 'should not make the backdrop hit-testable after touchend when not standalone' , ( ) => {
436+ makeSoloTouchEvent ( 'touchend' , null , backdrop ) ;
437+ expect ( backdrop . style . pointerEvents ) . to . equal ( '' ) ;
438+ } ) ;
439+
440+ // The backdrop is kept hit-testable for a while to catch the ghost click.
441+ describe ( 'standalone (iOS home screen)' , ( ) => {
442+ let standaloneDescriptor , clock ;
443+
444+ beforeEach ( ( ) => {
445+ standaloneDescriptor = Object . getOwnPropertyDescriptor ( navigator , 'standalone' ) ;
446+ Object . defineProperty ( navigator , 'standalone' , { configurable : true , value : true } ) ;
447+ clock = sinon . useFakeTimers ( ) ;
448+ } ) ;
449+
450+ afterEach ( ( ) => {
451+ clock . restore ( ) ;
452+ if ( standaloneDescriptor ) {
453+ Object . defineProperty ( navigator , 'standalone' , standaloneDescriptor ) ;
454+ } else {
455+ delete navigator . standalone ;
456+ }
457+ } ) ;
458+
459+ it ( 'should keep the backdrop hit-testable after touchend' , ( ) => {
460+ makeSoloTouchEvent ( 'touchend' , null , backdrop ) ;
461+ expect ( backdrop . style . pointerEvents ) . to . equal ( 'auto' ) ;
462+ } ) ;
463+
464+ it ( 'should stop keeping the backdrop hit-testable after the timeout' , ( ) => {
465+ makeSoloTouchEvent ( 'touchend' , null , backdrop ) ;
466+ clock . tick ( 500 ) ;
467+ expect ( backdrop . style . pointerEvents ) . to . equal ( '' ) ;
468+ } ) ;
469+
470+ it ( 'should stop keeping the backdrop hit-testable after a click' , ( ) => {
471+ makeSoloTouchEvent ( 'touchend' , null , backdrop ) ;
472+ backdrop . click ( ) ;
473+ expect ( backdrop . style . pointerEvents ) . to . equal ( '' ) ;
474+ } ) ;
475+ } ) ;
476+
435477 it ( 'should close the drawer when calling helper method' , ( ) => {
436478 layout . constructor . dispatchCloseOverlayDrawerEvent ( ) ;
437479 expect ( layout . drawerOpened ) . to . be . false ;
0 commit comments