Skip to content

Duplicate mouse events when acceptsFirstMouse: true #151

@oscarmarcelo

Description

@oscarmarcelo

Issue

When acceptsFirstMouse: true, if the clicked element also has attached events to the corresponding mouse event used to simulate the first click (See dispatch-first-click.js), it will end up triggering them twice, because the first click trick will also trigger them synthetically.

This is a specially unwanted behaviour when the said element is disabled (e.g. <button>), which shouldn't trigger click events.

Possible Fixes

The code used to run this should also check for the disabled state.
Also, it needs check if the element already has attached events to avoid making them run twice.

I would PR something for this, but honestly I haven't come up with a good solution to address the second part without affecting some obscure cases.
I can still send a PR and wait for someone help me, tough...

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