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

Bug: Root event delegation causes accessibiliy issues #23170

Closed
DarioR01 opened this issue Jan 24, 2022 · 1 comment
Closed

Bug: Root event delegation causes accessibiliy issues #23170

DarioR01 opened this issue Jan 24, 2022 · 1 comment
Labels
Resolution: Duplicate Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@DarioR01
Copy link

DarioR01 commented Jan 24, 2022

React version: 17.0.2

Steps To Reproduce

  1. Use NVDA in Firefox to Navigate through the first code example provided below. (use down arrow keystrokes to navigate the page)
  2. Notice how the graphic elements get announced as clickable.

Link to code example:

<!DOCTYPE html>
<html lang='en'>

<head>
    <title>Basic HTML5 document</title>
    <meta charset='utf-8'>
</head>

<body>
    <div id="root">
            <img src="https://picsum.photos/200/300" alt="test text"/>
    </div>

    <script>
        // event delegation
        document.querySelector('#root').addEventListener('click', () => { console.log('click') })
    </script>
</body>

</html>

From the above minimal example, you can see how events delegated to the root cause NVDA to announce the element as clickable.

If we take this other example:

<!DOCTYPE html>
<html lang='en'>

<head>
    <title>Basic HTML5 document</title>
    <meta charset='utf-8'>
</head>

<body>
    <div id="root">
            <img src="https://picsum.photos/200/300" alt="test text"/>
    </div>

    <script>
        // event delegation
        document.addEventListener('click', () => { console.log('click') })
    </script>
</body>

</html>

The element will not be read as clickable.

Putting handlers on the root is a loss of semantics, and causes the intention of handlers to be no longer communicated well to the assistive technology.

The current behaviour

NVDA reads clickable due to event delegation performed at the root level.

The expected behaviour

NVDA should not read clickable.
Could react provide a way for authors to arbitrarily delegate events to the document node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants