File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -987,7 +987,7 @@ class Popover extends PopoverPositionMixin(
987987 }
988988
989989 // Restore pointer-events set when opening on hover.
990- if ( this . modal && this . target . style . pointerEvents ) {
990+ if ( this . modal && this . target && this . target . style . pointerEvents ) {
991991 this . target . style . pointerEvents = '' ;
992992 }
993993
Original file line number Diff line number Diff line change @@ -143,6 +143,21 @@ describe('popover', () => {
143143
144144 expect ( document . activeElement ) . to . not . equal ( target ) ;
145145 } ) ;
146+
147+ it ( 'should not throw when target is removed' , async ( ) => {
148+ popover . modal = true ;
149+
150+ // Clear target
151+ popover . target = null ;
152+ await nextUpdate ( popover ) ;
153+
154+ popover . opened = true ;
155+ await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
156+
157+ // No error should be thrown
158+ popover . opened = false ;
159+ await oneEvent ( popover , 'closed' ) ;
160+ } ) ;
146161 } ) ;
147162
148163 describe ( 'for' , ( ) => {
You can’t perform that action at this time.
0 commit comments