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

Fix: Removed select on focus behaviour allowed space and enter for selection #230

Merged
merged 5 commits into from
Feb 4, 2025

Conversation

oliverfoster
Copy link
Member

@oliverfoster oliverfoster commented Jan 16, 2025

fixes #229

This should fix ios voiceover selection issues on radio (single select) mcqs and gmcqs

Reference: https://www.w3.org/WAI/ARIA/apg/patterns/radio/

Fix

  • Remove select on focus
  • Allow both space and enter to toggle
  • Deprecated onKeyPress for onKeyDown

@swashbuck
Copy link

swashbuck commented Jan 16, 2025

@oliverfoster The keyPress event is deprecated. Can you switch it to the keyDown event and rename the function?

onKeyPress={onKeyPress}

Copy link

@swashbuck swashbuck left a comment

Choose a reason for hiding this comment

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

👍 Tested iPhone 13 with VoiceOver iOS

Copy link
Contributor

Choose a reason for hiding this comment

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

👀

Copy link
Contributor

@kirsty-hames kirsty-hames left a comment

Choose a reason for hiding this comment

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

This works as expected for single select (radio) MCQs however multi select (checkbox) MCQs no longer allow you to toggle selection with space. Enter works fine.

When pressing space, the previous selection is unchecked but the focused item isn't checked. You get an intermittent flash of a selection.

Testing with Safari on Mac.

@oliverfoster
Copy link
Member Author

Cool, thanks @kirsty-hames

@oliverfoster
Copy link
Member Author

Space was triggering both a keydown and change event on the checkbox. I've got the keydown to prevent default so that the change event doesn't trigger in that eventuality.

Copy link
Contributor

@kirsty-hames kirsty-hames left a comment

Choose a reason for hiding this comment

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

Thanks @oliverfoster - both space and enter toggle selection 👍

@oliverfoster oliverfoster merged commit 5e6284f into master Feb 4, 2025
@oliverfoster oliverfoster deleted the issue/229-voiceover-accessibility branch February 4, 2025 14:49
github-actions bot pushed a commit that referenced this pull request Feb 4, 2025
## [7.5.2](v7.5.1...v7.5.2) (2025-02-04)

### Fix

* Removed select on focus behaviour allowed space and enter for selection (#230) ([5e6284f](5e6284f)), closes [#230](#230)
Copy link

github-actions bot commented Feb 4, 2025

🎉 This PR is included in version 7.5.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Recently Released
Development

Successfully merging this pull request may close these issues.

VoiceOver iOS: Moving focus automatically selects a radio
4 participants