whatwg / dom

DOM Standard
https://dom.spec.whatwg.org/
Other
1.57k stars 293 forks source link

Need a method to fire :hover and :active states #578

Open Nadya678 opened 6 years ago

Nadya678 commented 6 years ago

Because emulating (dispatchEvent) of mouse events (mouseenter, mouseover, mousedown) doesn't fire :hover nor :active CSS states we need a methods to toggle :active and :hover states. Like Element.focus() toggles :focus and Element.blur() removes :focus state.

I write web App and I can translate touch* events into series of left mouse buttons clicks but without visual effects like hovered and activated states. It is annoying for me like for other 34 persons registered on Stack Overflow.

Or...

A property in Event to check the event will fire default actions like :hover, :active

guest271314 commented 6 years ago

FWIW the source code for Chromium/Chrome devtools "ElementStatePaneWidget", which allows toggling CSS :active and :hover states https://github.com/ChromeDevTools/devtools-frontend/blob/ad7d5894be95f230de5f14712815c9cef4b34845/front_end/elements/ElementStatePaneWidget.js