Skip to content

fix: remove target listeners when popover is detached - #7694

Merged
web-padawan merged 1 commit into
mainfrom
fix/popover-listeners-detached
Aug 26, 2024
Merged

web-padawan merged 1 commit into
mainfrom
fix/popover-listeners-detached

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Description

Fixes #7683

This removes target event listeners when vaadin-popover is disconnected from the DOM, and restores them in case it is re-connected later.

Type of change

  • Bugfix

Note

There might be a case when target is set before adding vaadin-popover to the DOM, causing event listeners to be added twice. According to the spec this is not a problem as duplicate listeners are discarded:

If multiple identical EventListeners are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener method.

I tested this manually and confirmed this doesn't cause problems, so I think we don't need to have some flags to prevent it.

@sonarqubecloud

Copy link
Copy Markdown

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.5.0.alpha12 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Popover still opens on target click after being removed from DOM

3 participants