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

[Dropdown Menu] WCAG2.2 SC 2.5.2 violation - Dropdown Menu opens on onPointerDown #3124

Open
bolonio opened this issue Sep 18, 2024 · 0 comments

Comments

@bolonio
Copy link

bolonio commented Sep 18, 2024

Bug report

The Radix Dropdown Menu component opens on onPointerDown (which means as soon as a mouse navigation user presses the triggering element of the dropdown menu), but there is not available a function on the up-event, or a mechanism to abort the function before completion or to undo the function after completion. You can take a look at the Understanding SC 2.5.2: Pointer Cancellation (Level A) article for more information.

The intent of this success criterion is to make it easier for users to prevent accidental or erroneous pointer input. People with various disabilities can inadvertently initiate touch or mouse events with unwanted results. Each of the following subsections roughly aligns with the bullets of this Success Criterion, and outlines a means of allowing users to cancel pointer operations.

Source: Understanding SC 2.5.2: Pointer Cancellation (Level A)

Current behavior

  1. A mouse navigation user clicks (and holds) the triggering element of the dropdown menu.
  2. Without releasing, moves the mouse outside of both the triggering element or the dropdown menu area.
  3. The dropdown menu is not closed (cancelling the function).

CleanShot 2024-09-18 at 15 40 57

Expected behavior

  1. A mouse navigation user clicks (and holds) the triggering element of the dropdown menu.
  2. The dropdown menu is not yet open.
  3. The user releases the mouse click while still hovering the triggering element of the dropdown menu.
  4. The dropdown menu opens.

CleanShot 2024-09-18 at 15 45 29

You can see the behaviour in the W3C Menu Button Pattern or in the W3C Menu Bar Pattern

CleanShot 2024-09-18 at 15 42 00

or moving the mouse outside of the dropdown menu triggering and content should cancel the onPointerDown function.

  1. A mouse navigation user clicks (and holds) the triggering element of the dropdown menu.
  2. The dropdown menu opens.
  3. Without releasing, moves the mouse outside of both the triggering element or the dropdown menu area.
  4. The dropdown menu closes.
  5. The user releases the mouse click while hovering outside of both the triggering element or the dropdown menu area.
  6. The dropdown menu is still closed.

Reproducible example

Radix Dropdown Menu component

Suggested solution

Change the opening of the dropdown menu to onPointerUp or onClick instead of using onPointerDown.

Additional context

Here there are some examples of Radix components which meet the criteria, such as:

Note: It might be related to #2700 (not 100% sure about it though)

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-dropdown-menu ^2.0.5
React n/a 18.2.0
Browser Google Chrome 128.0.6613.138
Assistive tech
Node n/a
npm/yarn
Operating System MacOS 14.6.1
@bolonio bolonio changed the title WCAG2.2 SC 2.5.2 violation - Dropdown Menu opens on onPointerDown [Dropdown Menu] WCAG2.2 SC 2.5.2 violation - Dropdown Menu opens on onPointerDown Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant