Posted 12 February 2018, 7:37 pm EST
When a popup is inside an Angular Material Dialog (mat-dialog-container) we get the following error when trying to show the popup (through an owner trigger):
ERROR TypeError: Cannot read property ‘getBoundingClientRect’ of null
at Object.showPopup (wijmo.js:4175)
at t.show (wijmo.input.js:13)
at t._handleClick (wijmo.input.js:13)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4724)
at ZoneDelegate.invokeTask (zone.js:420)
at Zone.runTask (zone.js:188)
at ZoneTask.invokeTask [as invoke] (zone.js:496)
at invokeTask (zone.js:1517)
at HTMLElement.globalZoneAwareCaptureCallback (zone.js:1575)
The problems seems to be inside:
function showPopup(popup, ref, above, fadeIn, copyStyles) {…}
The following line seems to be the problem:
var elParent = parent == document.body ? document.documentElement : popup.offsetParent
popup.offsetParent returns NULL because popup has style.display = ‘none’ - and offsetParent will always be NULL when the element has style.display = ‘none’;
In Wijmo .359 it seems to work because the following is called before asking for the popup.offsetParent:
setCss(popup, {
position: ‘absolute’,
visibility: ‘hidden’,
display: ‘’
});
I have tried hooking up on the popover’s showing event and manually set display = ‘’ - this seems to work every other time but it seems the showing event only is called every other time.
So I believe that there is an error in showPopup(…) - e.g. that display needs to be cleared before asking for the popup.offsetParent.
Can anyone confirm this?