Hey @nicolaschevobbe, I have a question that you may be able to help me with.
-
Hey @nicolaschevobbe, I have a question that you may be able to help me with. What's the difference between the Click and Press action in Firefox DevTools? When you attach a click event to a button you get Press. When you attach it to a div you get Click.
Thank you!
-
@matuzo @nicolaschevobbe I think that if you attach a click handler to a button, that click handler gets activated when you either click with the mouse or tab to it and press space with a keyboard. If you attach a click handler to a div, it will only be activated by clicking the mouse. So click means click, not "activate with all default input methods". (1/2)
-
-
Manuel Matuzovićreplied to Nicolas Chevobbe last edited by
@nicolaschevobbe @marco @jcsteh makes sense! I added both keyup and key down events to the div but it's still Click. I'm probably missing something and I'd love to know what! Thanks for your input, Marco!
-
@matuzo it seems like it's the internal representation of the event on a button. Like when you add a click event on a link, the name is Jump while click if the link is missing the href attribute. But I'm just guessing here. @nicolaschevobbe @marco @jcsteh
-
@Thain @matuzo @nicolaschevobbe @marco There is no actual difference. It's purely based on the semantic role (implicit or explicit) of the control. You generally shouldn't be adding a click handler to a div without a role.
-
@jcsteh @Thain @nicolaschevobbe @marco the button has an explicit button role. The idea was to recreate a button with a div and see if there are differences in the a11y tree representation in dev tools.