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 @@ -950,7 +950,7 @@ class Popover extends PopoverPositionMixin(
950950 }
951951
952952 // Restore pointer-events set when opening on hover.
953- if ( this . modal && this . target . style . pointerEvents ) {
953+ if ( this . modal && this . target && this . target . style . pointerEvents ) {
954954 this . target . style . pointerEvents = '' ;
955955 }
956956
Original file line number Diff line number Diff line change @@ -149,6 +149,21 @@ describe('popover', () => {
149149
150150 expect ( document . activeElement ) . to . not . equal ( target ) ;
151151 } ) ;
152+
153+ it ( 'should not throw when target is removed' , async ( ) => {
154+ popover . modal = true ;
155+
156+ // Clear target
157+ popover . target = null ;
158+ await nextUpdate ( popover ) ;
159+
160+ popover . opened = true ;
161+ await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
162+
163+ // No error should be thrown
164+ popover . opened = false ;
165+ await oneEvent ( popover , 'closed' ) ;
166+ } ) ;
152167 } ) ;
153168
154169 describe ( 'for' , ( ) => {
You can’t perform that action at this time.
0 commit comments