@@ -9,7 +9,7 @@ type OpenUI5Popup = {
9
9
open : ( ...args : any [ ] ) => void ,
10
10
_closed : ( ...args : any [ ] ) => void ,
11
11
getOpenState : ( ) => "CLOSED" | "CLOSING" | "OPEN" | "OPENING" ,
12
- getContent : ( ) => Control | HTMLElement , // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)
12
+ getContent : ( ) => Control | HTMLElement | null , // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)
13
13
onFocusEvent : ( e : FocusEvent ) => void ,
14
14
}
15
15
} ;
@@ -35,7 +35,7 @@ const patchOpen = (Popup: OpenUI5Popup) => {
35
35
if ( openingInitiated && topLayerAlreadyInUse ) {
36
36
const element = this . getContent ( ) ;
37
37
if ( element ) {
38
- const domRef = element instanceof HTMLElement ? element : element . getDomRef ( ) ;
38
+ const domRef = element instanceof HTMLElement ? element : element ? .getDomRef ( ) ;
39
39
if ( domRef ) {
40
40
openNativePopover ( domRef ) ;
41
41
}
@@ -48,7 +48,7 @@ const patchClosed = (Popup: OpenUI5Popup) => {
48
48
const _origClosed = Popup . prototype . _closed ;
49
49
Popup . prototype . _closed = function _closed ( ...args : any [ ] ) {
50
50
const element = this . getContent ( ) ;
51
- const domRef = element instanceof HTMLElement ? element : element . getDomRef ( ) ;
51
+ const domRef = element instanceof HTMLElement ? element : element ? .getDomRef ( ) ;
52
52
_origClosed . apply ( this , args ) ; // only then call _close
53
53
if ( domRef ) {
54
54
closeNativePopover ( domRef ) ; // unset the popover attribute and close the native popover, but only if still in DOM
0 commit comments