Repository navigation
Conversation
Since the BrowserWindow's WebContentsView became a sibling of the window's contentView painted beneath it (electron#41256), the empty contentView container has been exposed to assistive technology as an empty pane covering the whole window. ViewAXPlatformNodeDelegate::HitTestSync searches children topmost-first and returns the empty pane, so screen reader hit-tests (e.g. NVDA mouse tracking) can no longer reach the web contents beneath it. Mark a default-constructed api::View's plain container as ignored and invisible to accessibility while it has no children. Ignored removes the empty pane from the accessibility tree; invisible makes AX hit-tests skip it so they fall through to the web contents. The state is cleared as soon as child views are added, so contentView-based layouts (e.g. multiple WebContentsViews) are still fully exposed to assistive technology. This follows the pattern of Chromium's ash::NonAccessibleView. Fixes electron#42945 Co-Authored-By: Claude Fable 5 <[email protected]>
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
MarshallOfSound
left a comment
There was a problem hiding this comment.
Repro'd #42945 on Linux by hit testing through AT-SPI, which goes through the same HitTestSync path. This does fix the default case, the centre of the window now resolves to the page instead of an empty panel.
It doesn't cover a contentView that has children though, see inline. That includes every BrowserView, since addBrowserView puts its view in contentView, so I'd like to see that handled before we land this.
…point Share the ContentViewTargeterDelegate that macOS already installs on content_view_ with the views platforms so ViewAXPlatformNodeDelegate::HitTestSync falls through to the sibling WebContentsView wherever no child covers the point, not just while the container is childless. Keep the childless container ignored so the empty pane stays out of the accessibility tree. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Hi Thank you so much for addressing this accessibility bug, it will be a huge improvement in low vision user's experience. Do you have a timeline to finalize the PR and have a new version available in npm? Thanks! |
|
Thanks @rafa11rodrigues, glad it's useful. I can't give a date, since merging and releasing are up to the Electron maintainers, but here's where it stands:
Once it merges it'll ship in the next nightly/alpha. Whether it gets backported to the current stable releases is up to the maintainers. |
|
Change of plans: I won't be able to follow up on this properly for about 2 weeks, sorry. |
|
This PR was left with two open items: a rebase on I picked both up. The same fix, rebased on current (An earlier pull request, #55323, carried the same branch; GitHub closed it automatically a few seconds after it was opened, because the description did not yet contain the sections the template check looks for. The description was corrected, but GitHub then refused to reopen that pull request, so the branch is proposed again under #55334.) Two differences worth noting for review:
@wittjeff feel free to close this one, or to take the fix commits from #55334 if you prefer to continue here. |
|
Closing in favor of #55334, which continues this work: it rebases the same fix on current |
Description of Change
Since #41256, a
BrowserWindow'sWebContentsViewis a sibling of the window'scontentView, inserted before it so thatcontentViewchildren paint on top of the web contents.BaseWindowauto-creates itscontentViewas a plainviews::Viewcovering the whole window, and that container sits above the web contents in the view order.ViewAXPlatformNodeDelegate::HitTestSyncsearches children topmost-first and returns the first child whoseHitTestPoint()succeeds. With a plain bounds check, the full-windowcontentViewwins every accessibility hit-test over the web contents beneath it, whether or not it has children: with no children it is the final result (the empty pane in #42945, bisected to30.0.0-beta.8/ #41256), and with children it still wins for every point outside them, e.g. anywhere outside aBrowserView. NVDA's mouse tracking lands on the empty pane and goes silent.View::HitTestPoint()isGetEffectiveViewTargeter()->DoesIntersectRect(), so aViewTargeteroncontentViewgoverns both mouse targeting and accessibility hit-tests. macOS already installs exactly such a targeter (ContentViewTargeterDelegate, from #50330 and #51617) so mouse events fall through to theWebContentsView. This PR:NativeWindow::InstallContentViewTargeter()and calls it from bothNativeWindowMac::SetContentViewandNativeWindowViews::SetContentView, so on Windows and LinuxcontentViewonly intersects a point where one of its visible children does. Accessibility hit-tests and views mouse targeting then fall through to theWebContentsViewwherever no child covers the point, regardless of how many childrencontentViewhas. macOS behaviour is unchanged.api::View's plain container as ignored while it has no children, so the empty pane also disappears from tree navigation (the extra pane seen in Inspect.exe). As soon as children are added it returns to the tree. Views wrapped byapi::Viewsubclasses (WebContentsView,ImageView, etc.) are unaffected.On Windows and Linux, mouse events over web content are delivered to the
RenderWidgetHostViewAurawindow and never reach the viewsRootView, so the targeter only changes views targeting where neither web content nor acontentViewchild is under the point; there the target becomes the main view instead of the empty container, and neither handles mouse events.Verification
Linux, AT-SPI
Component.GetAccessibleAtPointfrom the window frame (sameHitTestSyncpath), Xvfb,app.setAccessibilitySupportEnabled(true). Baseline is Electron 44.2.0; "patched" is this branch.contentViewcontentView)document webcontentView, 1 child)document webcontentView; childless child is ignored)contentView, 1 child)static"Hello a11y" (web content)BrowserView200x150contentView, 1 child)document webBrowserView200x150document web(BrowserView)document web(BrowserView)BrowserView200x150contentView, 1 child)paragraph(web content)The empty
contentViewno longer appears under the main view in the tree. Not verified on Windows with NVDA / Inspect.exe; repro steps are in #42945. cc @codebytereFixes #42945
Checklist
npm testpasses locally — Linux build verified with the AT-SPI hit-tests above; native accessibility hit-testing is not observable from the JS specsRelease Notes
Notes: Fixed screen readers detecting an empty pane instead of the window's web contents (e.g. broken NVDA mouse tracking) caused by the BrowserWindow's contentView container overlaying the WebContentsView in the accessibility tree.
🤖 Generated with Claude Code