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 @@ -148,6 +148,21 @@ describe('popover', () => {
148148
149149 expect ( document . activeElement ) . to . not . equal ( target ) ;
150150 } ) ;
151+
152+ it ( 'should not throw when target is removed' , async ( ) => {
153+ popover . modal = true ;
154+
155+ // Clear target
156+ popover . target = null ;
157+ await nextUpdate ( popover ) ;
158+
159+ popover . opened = true ;
160+ await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
161+
162+ // No error should be thrown
163+ popover . opened = false ;
164+ await oneEvent ( popover , 'closed' ) ;
165+ } ) ;
151166 } ) ;
152167
153168 describe ( 'for' , ( ) => {
You can’t perform that action at this time.
0 commit comments