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

Ensure that focus remains on the button that was clicked. #2988

Open h-parekh opened 6 years ago

h-parekh commented 6 years ago

Descriptive summary

Keyboard focus is lost each time a new sort button is clicked.

Rationale

WCAG guideline 3.2.2:

The intent of this Success Criterion is to ensure that entering data or selecting a form control has predictable effects

Expected behavior

Focus should remain on the button that was clicked

Actual behavior

On clicking a button using keyboard, the button loses its focus. Affected items:

Steps to reproduce the behavior

  1. Search for something in Nurax - Example page
  2. Tab through using your keyboard to any of the buttons listed above and hit 'Return' key.
  3. Notice that the button lost focus

Related work

https://github.com/samvera/hyrax/issues/1246 is similar tabbed focus issue for keyboard users, but may have a different root cause.

adamjarling commented 6 years ago

@no-reply @vantuyls Looks like the element <div id="sortAndPerPage" class="clearfix"> which houses these buttons is coming from Blacklight. I put the "Blacklight" label on it, and will kick this to the bottom of the current Hyrax WG Sprint Ready column.

jcoyne commented 6 years ago

I believe this is happening because activating these buttons is causing a new page to be loaded. So the focus starts over at the top of the page. I believe I see the same problem manifest on https://demo.projectblacklight.org

adamjarling commented 6 years ago

@jcoyne Yes, you're right the selection is causing a new page load which will make retaining focus on the element tricky. Maybe we evaluate the cost of a solution vs. the cost of keeping this as-is.

jcoyne commented 6 years ago

@h-parekh I wonder if the solution for you is to not use Turbolinks?

rjkati commented 3 years ago

Issue is still present in Hyrax 3.0.0.pre.rc3.

jlhardes commented 3 years ago

Need to check if this issue is a known issue in Blacklight or if it is fixed in a later version. If there is an open issue, link that issue here. If no issue or fix, create an issue for Blacklight (and we might do the work to fix and contribute back but at least it will be reported).

rjkati commented 2 years ago

This issue is still present in Hyrax 4.0.0beta1.

scherztc commented 9 months ago

The issue is still present on dev.nurax.samvera.org.

Hyrax Version: 5.0.0.rc2

jlhardes commented 7 months ago

Verified this is still present in Hyrax 5.0.0 on https://dev.nurax.samvera.org/. This is also still present on http://demo.projectblacklight.org/ so this is a Blacklight issue that we need to report and share with Blacklight (and possibly contribute a fix).