Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
The situation stems from multiple inputs needing to be associated with one label elt. The current setup is compliant until a second input is automatically generated when the first one has a value.
Guidance for testing, such as acceptance criteria or new user interface behaviors:
*Bring up the edit page for a user collection (#6802), and run an accessibility checker. The second title input box should not be flagged for A 4.1.2, Form field missing a label.
Same instructions for editing a work(#6816): the second title input box should not be flagged for A 4.1.2.
Type of change (for release notes)
notes-minor
Detailed Description
As it stands, the title label element has no ID, uses for="collection_title" to associate with the initial title input.
When a second title input is automatically added, the label's "for" property would no longer be of use. Instead, both inputs use aria-labelledby="collection_title_label" but the label elt does not have that ID.
The proposed fix adds javascript to add the appropriate ID to the label elt.
This fix was originally published here: https://github.com/OregonDigital/OD2/commit/f32e7e86fd73a7f7484fbccc6913641535c519ab
Adapted to cover elements in the form that are not of type input (eg text-area)
If no element is found, the id is not assigned; this is to avoid adding an id "undefined_label" to the location label. The location partial has its own method of dealing with associating the label.
Changes proposed in this pull request:
Adding the field_manager js from HydraEditor and then overriding it.
Results for commit 968f7f77. ± Comparison against base commit 5973742c.
This pull request removes 266 and adds 266 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 #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 5bddec03-9520-4026-9f59-9b2cdf2db3f3
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 78b178c6-3969-4c19-a770-d91ede0b2365
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 0ed322cc-eba9-437c-83a0-9c2ab5260896
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 5641845b-0085-46b3-8cd5-b4dd6a74a051
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: ec785e75-94b3-4855-a647-5352ef4b4350
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 620247fe-afb9-4ff2-bf6a-409da12edc4a
…
```
```
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 114b3671-145e-456c-8551-f4acf6f24b23
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: d1d181dc-0948-4532-89ff-cb3d8e8efa4c
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 1d33f11a-858f-4a24-b504-62eab22c06aa
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 1171d9db-5531-4b10-b529-218cc1f7f279
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: c225855b-a17e-4510-8ac4-78df78583779
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: fb57f7b3-9da1-4f92-b1f6-c12984cfb268
…
```
Fixes
Fixes #6802 Fixes #6816
Summary
The situation stems from multiple inputs needing to be associated with one label elt. The current setup is compliant until a second input is automatically generated when the first one has a value.
Guidance for testing, such as acceptance criteria or new user interface behaviors:
*Bring up the edit page for a user collection (#6802), and run an accessibility checker. The second title input box should not be flagged for A 4.1.2, Form field missing a label.
Same instructions for editing a work(#6816): the second title input box should not be flagged for A 4.1.2.
Type of change (for release notes)
notes-minor
Detailed Description
As it stands, the title label element has no ID, uses for="collection_title" to associate with the initial title input.
When a second title input is automatically added, the label's "for" property would no longer be of use. Instead, both inputs use aria-labelledby="collection_title_label" but the label elt does not have that ID. The proposed fix adds javascript to add the appropriate ID to the label elt.
This fix was originally published here: https://github.com/OregonDigital/OD2/commit/f32e7e86fd73a7f7484fbccc6913641535c519ab Adapted to cover elements in the form that are not of type input (eg text-area) If no element is found, the id is not assigned; this is to avoid adding an id "undefined_label" to the location label. The location partial has its own method of dealing with associating the label.
Changes proposed in this pull request:
@samvera/hyrax-code-reviewers