Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
JesmoDev committed Nov 2, 2023
1 parent 64c5143 commit 8610412
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/uui-popover-container/lib/uui-popover-polyfill.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @ts-nocheck

import { findAncestorByAttributeValue } from '@umbraco-ui/uui-base/lib/utils';
export function polyfill() {
const originalAddEventListener = this.addEventListener;

Expand Down Expand Up @@ -80,6 +82,20 @@ export function polyfill() {
if (!this.polyfill_hasBeenMovedToBody) {
this.polyfill_parentPopoverContainer = findParentPopover(this);
}

this.polyfill_targetElement = findAncestorByAttributeValue(
this,
'popovertarget',
this.id
);

if (!this.polyfill_targetElement) {
console.error(
'Could not find a popover target for this popover. Make sure the popover target has a popovertarget attribute with the value of this popover id.'
);
return;
}

this.polyfill_onBeforeToggle({
oldState: 'closed',
newState: 'open',
Expand Down

0 comments on commit 8610412

Please sign in to comment.