Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow detail argument for HTMLElement.click() #7095

Open
MichaelAllenWarner opened this issue Sep 21, 2021 · 1 comment
Open

Allow detail argument for HTMLElement.click() #7095

MichaelAllenWarner opened this issue Sep 21, 2021 · 1 comment
Labels
addition/proposal New features or enhancements interop Implementations are not interoperable with each other needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@MichaelAllenWarner
Copy link

It would be useful if HTMLElement.click() accepted an optional Number argument that became the value of the synthetic event's detail property (representing the click-count).

Currently, one can do something like EventTarget.dispatchEvent(new MouseEvent('click', { detail: 1 })) to achieve more-or-less the same thing, but:

  1. it's a bit ugly and cumbersome; and
  2. it's not quite the same thing, at least in terms of implementation. For example, in all browsers that I tested, HTMLElement.click() has no effect when the target is a disabled button, but when I tried using EventTarget.dispatchEvent() to fire a click-event on a disabled button, I found that behavior differed across browsers—e.g., in Safari the event-handler was executed, and in Chrome it was not.
@annevk annevk transferred this issue from whatwg/dom Sep 22, 2021
@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest interop Implementations are not interoperable with each other labels Sep 22, 2021
@saschanaz
Copy link
Member

saschanaz commented Sep 27, 2021

  1. but when I tried using EventTarget.dispatchEvent() to fire a click-event on a disabled button, I found that behavior differed across browsers—e.g., in Safari the event-handler was executed, and in Chrome it was not.

#2368? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements interop Implementations are not interoperable with each other needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

3 participants