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
184 stars 124 forks source link

Fix catalog search dropdown #6867

Closed kirkkwang closed 2 months ago

kirkkwang commented 2 months ago

Summary

Fix catalog search form dropdown not changing

7a2d4768f33ea95e2f9e560dedb96e16d74cac16

On the home page when the user is logged in, the dropdown next to the search was not changing when the user selects a different option. This was because the javascript was changing the data-search-element="label" span but what is actually being shown is the aria-hidden="true" span.

Before:

  <span class="sr-only" data-search-element="label">All</span>
  <span aria-hidden="true">All</span>

  *user selects a different option*

  <span class="sr-only" data-search-element="label">My Works</span>
  <span aria-hidden="true">All</span>

After:

  <span class="sr-only" data-search-element="label">All</span>
  <span aria-hidden="true">All</span>

  *user selects a different option*

  <span class="sr-only" data-search-element="label">My Works</span>
  <span aria-hidden="true">My Works</span>

Change html structure for search dropdown

9b2ffae723d56ba63bade38932371430a7be9f23

This change will align how Bootstrap 4 does dropdown menus. The exmaples that I see in the documentation show that it should be in a

tag with tags inside of it. ### Guidance for testing, such as acceptance criteria or new user interface behaviors: * Sign in to Hyrax * On the search form, click the dropdown (should say `All` by default) and choose something else * Observe that the label changes accordingly ### Type of change (for release notes) - `notes-bugfix` Bug Fixes ### Changes proposed in this pull request: * Fix a bug where the label doesn't change for the search form when the user clicks it * Change the html structure to be more Bootstrap 4 friendly https://github.com/user-attachments/assets/784df82d-dac8-4897-98bf-dd248a0b8006 @samvera/hyrax-code-reviewers
github-actions[bot] commented 2 months ago

Test Results

    17 files  ±0      17 suites  ±0   2h 17m 11s :stopwatch: - 4m 15s  6 705 tests ±0   6 408 :white_check_mark: +1  297 :zzz: ±0  0 :x:  - 1  13 178 runs  ±0  12 783 :white_check_mark: +1  395 :zzz: ±0  0 :x:  - 1 

Results for commit 9b2ffae7. ± Comparison against base commit 59a42adf.

This pull request removes 273 and adds 273 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: 133a9822-768b-48ad-a346-396b70d63b8b spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: d2a1f5ab-99e3-4f8a-af33-0f3fdb07e5a2 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: c5cdc4e2-8185-4228-a98c-b012fbea7e7f spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 67871b8d-cc2d-4fee-8a21-c9ae70f921ec spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: 84ed5efd-d6ce-4bf0-9187-6e1f28380843 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 7f6fdad7-4891-48e5-b492-1da2b3ab04db … ``` ``` 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: a58fa56b-cc11-4bd2-9eba-f168c46d612e spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 3e20f8dd-de5a-44f8-8573-0a5c916c72ae spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 418bddcb-407b-4167-bf5f-311523ffde8d spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 45225359-07b1-4a45-a557-772e98c06e19 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: a732d216-ffc7-44e8-a0f0-7cded4a17e50 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 1a175fe0-407a-42a9-b59c-4dae2bc3f870 … ```

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