mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 03:37:12 -04:00
Fix rare case of popover icons not found
This commit is contained in:
parent
b9def35bdd
commit
cf0dfc73f2
@ -467,6 +467,12 @@ function addEventListenersToPopoverIcons (anchor, popover, doc) {
|
|||||||
}
|
}
|
||||||
const closeIcon = doc.getElementById('popcloseicon');
|
const closeIcon = doc.getElementById('popcloseicon');
|
||||||
const breakoutIcon = doc.getElementById('popbreakouticon');
|
const breakoutIcon = doc.getElementById('popbreakouticon');
|
||||||
|
// If the icons are not found, do not add event listeners
|
||||||
|
if (!closeIcon || !breakoutIcon) {
|
||||||
|
console.warn('Popover icons not found in the document');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Add the popoverisloading property to the popover so that it can be removed
|
||||||
// Register mousedown event (should work in all contexts)
|
// Register mousedown event (should work in all contexts)
|
||||||
closeIcon.addEventListener('mousedown', function () {
|
closeIcon.addEventListener('mousedown', function () {
|
||||||
closePopover(popover);
|
closePopover(popover);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user