samvera / hyrax

Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
http://hyrax.samvera.org/
Apache License 2.0
185 stars 124 forks source link

apply missing id in js #6946

Closed lsat12357 closed 3 weeks ago

lsat12357 commented 3 weeks ago

Fixes

Fixes #6802

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:

Type of change (for release notes)

notes-minor

Detailed Description

As it stands, the title label element has no ID, uses for= to associate with the initial title input.

<label class="control-label multi_value required" for="collection_title">Title <span class="badge badge-info required-tag">required</span></label>

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

Changes proposed in this pull request:

@samvera/hyrax-code-reviewers

github-actions[bot] commented 3 weeks ago

Test Results

    17 files  ±0      17 suites  ±0   2h 16m 15s ⏱️ - 1m 25s  6 717 tests ±0   6 419 ✅  - 1  297 💤 ±0  1 ❌ +1  13 204 runs  ±0  12 807 ✅  - 1  396 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit f75060ce. ± Comparison against base commit a8ae9539.

This pull request removes 272 and adds 272 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: fbce70ad-6a49-4e8d-b673-d23238fe5a02 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 942a61e8-4a2a-4094-8fb9-659447408952 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 336e86e3-7ed5-47fc-bddb-a95a41d84c55 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 945b3161-72c1-4ca7-874f-54a87ce907db spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: 01cea523-4b49-4c9d-afbe-f4ac70ec871a spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 4fa5fe66-e99a-488d-85e9-edad73b6e48b … ``` ``` 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: c07a36c4-c380-4399-9b68-413c62c0a013 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 2ff2bbce-a00e-4fa2-9725-25a9af175493 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 89771b9e-2d83-4ce3-b043-a2d398103d2a spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 8eff419e-dbaa-4fe1-b1b1-867b83fecb1a spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: b0b88a74-25ac-4f35-b598-2a3551b36dd2 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 6b4a2137-cd23-4bcd-b17f-1cc80b4db919 … ```

:recycle: This comment has been updated with latest results.

lsat12357 commented 3 weeks ago

The changes to the file are the addition of the function _addInitialID() and its call in init()