Skip to content

fix: Improve VoiceOver experience when using Safari#10073

Merged
gonfunko merged 6 commits into
RaspberryPiFoundation:mainfrom
microbit-matt-hillsdon:voiceover-safari-fixes
Jun 26, 2026
Merged

fix: Improve VoiceOver experience when using Safari#10073
gonfunko merged 6 commits into
RaspberryPiFoundation:mainfrom
microbit-matt-hillsdon:voiceover-safari-fixes

Conversation

@microbit-robert

Copy link
Copy Markdown
Collaborator

The basics

The details

Resolves

Fixes #10066

Proposed Changes

This PR consists of many small changes that combine to improve the VoiceOver in Safari experience:

  • Do not append the element to the DOM that is about to be focused (causes VoiceOver cursor / focus decoupling). Instead move other elements before it. This is applied to blocks and rendered connections
  • Reorder blocks / connections inside requestAnimationFrame to avoid VoiceOver cursor flickers
  • Compute basic aria role and roledescription for rendered connections at draw time. This ensures that the element is focusable and understood by Safari to be focusable. The aria-label is still only calculated on focus.
  • Ensure that rendered connections are always visible. Toggling the display style causes real issues with Safari and VoiceOver. Instead, a class is used to manage the stroke highlighting and toggled where display was previously.
  • Ensures that the move mode icon stays at the front after the above changes

Reason for Changes

Maintains the 'bring to the front' fix for blocks focused via keyboard and improves VoiceOver in Safari.

Test Coverage

Manual testing in Safari with VoiceOver. Existing tests still pass.

Documentation

None

Additional Information

This change would really benefit from testing with different screen readers on different browsers to ensure that are no regressions.

Otherwise this only happens on focus and the first focus in Safari
with VoiceOver fails to output anything.
The full aria context for rendered conns is only calculated on focus
Connection previews are maintained by toggling a class.
Connectino reordering does not append element to be focused which
fixes VoiceOver in Safari behaviour.
@microbit-robert microbit-robert requested a review from a team as a code owner June 26, 2026 15:45
@microbit-robert microbit-robert requested a review from gonfunko June 26, 2026 15:45
@github-actions github-actions Bot added the PR: fix Fixes a bug label Jun 26, 2026

@gonfunko gonfunko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I kicked the tires in Chromevox and NVDA and it seems OK there as well. I did notice Voiceover is now reading an incorrect count for the number of blocks in the flyout, but on net this is still a big improvement.

@microbit-robert

Copy link
Copy Markdown
Collaborator Author

@gonfunko Good catch. I suspect this is because the rendered connections are present in the flyout and get included in the count now as they have roles. Probably fixable by having the role setting conditional on not being in a flyout, or ensuring that the block parent aria-owns its rendered connections (similar to icons). I won't have time to look at this until Monday, but happy for someone else to pick it up in the meantime.

@gonfunko

Copy link
Copy Markdown
Contributor

I'll merge this as-is for now and take a look at that myself.

@gonfunko gonfunko merged commit 19ba412 into RaspberryPiFoundation:main Jun 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with VoiceOver and Safari

2 participants