Skip to content

click outside case. Microtasks and addEventListener #9464

@Gormartsen

Description

@Gormartsen

What problem does this feature solve?

Ability to call method when click is outside element(component)

In 2.5.x there was simple way to do via document.addEventListener and el.contains(event.target)

It was useful specially via directive like v-click-outside="componentMethod"

After inspecting live circle in 2.6.x I found that eventListener happen after click processed inside component and event.target.parentElement is null (in case if there is inside click process that change component display)

Let me peripheries it.
In case if we have a component that change it's own rendering and we listen for EventListener click on $el of the component - EventListener function receive event.target of the removed DOM element.

Going back to the root issue.
How we can simply monitor multiple elements that need to change it's own display if user clicked outside element. Like dropdown element for example.

What does the proposed API look like?

Have no idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions