Skip to content

fix: keep window content view from blocking accessibility hit-tests - #56093

Open
rafa11rodrigues wants to merge 1 commit into
electron:mainfrom
rafa11rodrigues:fix/content-view-a11y-hit-test
Open

rafa11rodrigues wants to merge 1 commit into
electron:mainfrom
rafa11rodrigues:fix/content-view-a11y-hit-test

Conversation

@rafa11rodrigues

Copy link
Copy Markdown

Description of Change

This PR resolves an accessibility regression (#42945) where screen readers (NVDA, JAWS) fail to perform mouse tracking / mouse echo over web content on Windows and Linux starting in Electron 30.

This continues and addresses maintainer review feedback from #55334 (and originally #53460):

  1. Event targeter delegation: Installs ContentViewTargeterDelegate on Windows and Linux (matching macOS behavior in NativeWindowMac), allowing accessibility hit-tests and mouse targeting to fall through to WebContentsView unless covered by an actual child view.
  2. Accessible tree cleanup: Keeps the contentView out of the accessibility tree when childless (SetHideFromAccessibilityWhenChildless(true)), dynamically updating its ignored state when children are added, removed, or made visible/invisible.
  3. Spec tests: Relocates testing from docs/development to spec/api-view.spec.ts in accordance with testing guidelines.
  4. Consistency: 100% English code, comments, and commit messages.

Fixes #42945.

Checklist

Release Notes

Notes: Fixed an issue where the window content view blocked accessibility hit-testing on Windows and Linux.

BrowserWindow places its WebContentsView as a sibling of the window
content view, below it in the paint order, so that views added to the
content view are painted on top of the web content.

The content view covers the whole window, so the default bounds check
made it win every hit-test: ViewAXPlatformNodeDelegate::HitTestSync
returned the empty container instead of the web content, which broke
screen reader mouse tracking (electron#42945).

1. Install ContentViewTargeterDelegate on Windows and Linux (matching
   macOS behavior) so that the content view only intercepts points
   covered by its child views, allowing accessibility hit-tests and
   mouse targeting to fall through to the WebContentsView.
2. Keep the content view out of the accessibility tree while it has no
   visible children (SetHideFromAccessibilityWhenChildless), updating its
   ignored state dynamically when child views are added, removed, or change
   visibility.
3. Add unit test coverage in spec/api-view.spec.ts for child view management
   on the window content view.

Fixes electron#42945.

Co-authored-by: wittjeff <[email protected]>
Co-authored-by: Raphael Fougeroux <[email protected]>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

[Bug]: NVDA screen reader no longer works since 30.0.0-beta.8

1 participant