hyrax icon indicating copy to clipboard operation
hyrax copied to clipboard

Override hydra-editor screen reader text to 'this field' for accessib…

Open trmccormick opened this issue 1 month ago • 2 comments

Accessibility fix for screen reader text in hydra-editor (#7238)

Fixes

Fixes #7238 ; refs #7238

Summary

Override hydra-editor screen reader text to "this" for accessibility

Guidance for testing, such as acceptance criteria or new user interface behaviors:

  • The screen reader text for the remove button should now say "this" instead of "previous".
  • Test with a screen reader to confirm the updated text is announced.
  • Ensure the change appears on all relevant forms where hydra-editor is used.

Type of change (for release notes)

notes-bugfix Bug Fixes

Detailed Description

This PR adds a JavaScript override to update the screen reader text for the remove button in hydra-editor fields. Previously, the text read "previous", which was confusing for users relying on assistive technology. The override changes the text to "this" for clarity and improved accessibility.

The change is implemented in app/assets/javascripts/hyrax/hydra_editor_override.js and loaded via the asset pipeline. No changes were made to the hydra-editor gem itself.

Changes proposed in this pull request:

  • Add hyrax/hydra_editor_override.js to override screen reader text
  • Update asset manifest to load the override after hydra-editor

@samvera/hyrax-code-reviewers

trmccormick avatar Dec 01 '25 19:12 trmccormick

Test Results

    13 files  ±0      13 suites  ±0   2h 51m 6s ⏱️ - 3m 54s  6 953 tests  - 6   6 647 ✅  - 6  306 💤 ±0  0 ❌ ±0  18 504 runs  ±0  18 003 ✅ ±0  501 💤 ±0  0 ❌ ±0 

Results for commit 8c728eed. ± Comparison against base commit 8abde49b.

This pull request removes 373 and adds 367 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f01a9d4b7d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f52aab7d348>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f719ba39da0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f01a9dc4608>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f52ad3a5c80>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f71a0fd17e0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 51885775-9a18-4a12-b671-7249318fffd3
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 2034cdd3-5c87-4b86-b4ed-3aeb1e70114e
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 711f7ab4-2499-4350-987a-3c999916c9c6
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 672d84fc-931a-42c5-8a59-b4da949ad6e8
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f412e5a02a0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f555d667088>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f6726955a08>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f412e440158>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f555d71eb20>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f6729555b58>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 77dc1df9-fc81-48d7-8f40-2cd6852c761b
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 0d30fd76-cd83-40e6-a96c-b70d9a49f274
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 900970a4-19ac-4ce6-b991-e1932bd09fa4
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 1e3a602c-dd4a-405e-ace8-993e348abb84
…

github-actions[bot] avatar Dec 01 '25 20:12 github-actions[bot]

I'm concerned the css selector is not specific enough and might cause unintended side effects. I'm also not sure if using "this" is a significant improvement over "previous".

I did a little hacking in a browser inspector and found it should be possible to have the current value of the input field be read out by the screen reader (e.g. "Remove Title [alternate title of work]"). Doing so requires the generated inputs to have their own unique id which is non-trivial in the existing hydra-editor code, but doable.

dlpierce avatar Dec 04 '25 16:12 dlpierce