Skip to content

type('{enter}') does not fire click event #19541

@jamime

Description

@jamime

Current behavior

When the target element is a button type('{enter}') fires the events

  • keydown
  • keypress
  • keyup

image
Note the first "click" is from activating the button.

Desired behavior

When the target element is a button type('{enter}') should fire the events

  • keydown
  • keypress
  • click
  • keyup

image

Note the first "click" is from activating the button.

Test code to reproduce

https://github.com/jamime/cypress-test-tiny

Cypress Version

9.2.0

Other

If the key is the Enter or key and the current focus is on a state-changing element, the default action MUST be to dispatch a click event, and a DOMActivate event if that event type is supported by the user agent (refer to § 3.5 Activation triggers and behavior for more details)

https://w3c.github.io/uievents/#event-type-keydown

Once the cypress test has failed, if you click "reset", then click the second button and press "Enter" you will see the correct output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions