Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure sidebar panels are focused when open, and focus is restored when closed #5390

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Apr 13, 2023

This PR requires hypothesis/frontend-shared#957
It is also a continuation of #5361, where some of the improvements suggested there have been applied.

This PR makes use of the new Dialog focusing capabilities, to make sure the sidebar panels are focused when opened, and the focus is restored once closed.

It's done in a way that the Slider transitions are kept, so it has no visual changes.

focus-and-transition.mp4

This PR also fixes hypothesis/product-backlog#1421

TODO

  • Fix tests

Testing steps

  1. First make sure your local frontend-shared is up to date. Then build it with make build, and "publish" it with npx yalc publish. Not needed anymore.
  2. Clone this branch on your local client , and run npx yalc add @hypothesis/frontend-shared to install the version you published in previous step.
  3. Use the keyboard to open sidebar panels ("share annotations" or "help" ones can be used for testing).
  4. Check the focus behaves as expected, focusing the panel after the open transition has finished, and recovering focus to the button when close transition ends.

@acelaya acelaya requested a review from lyzadanger April 13, 2023 10:18
@acelaya acelaya force-pushed the sidebar-panels-autofocus branch from daa2585 to c9510b1 Compare April 14, 2023 08:59
@acelaya acelaya force-pushed the sidebar-panels-autofocus branch from c9510b1 to 52b7e70 Compare April 17, 2023 13:13
@acelaya acelaya marked this pull request as ready for review April 17, 2023 13:16
@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Merging #5390 (52b7e70) into main (24813dc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5390   +/-   ##
=======================================
  Coverage   99.19%   99.19%           
=======================================
  Files         237      237           
  Lines        9403     9406    +3     
  Branches     2243     2244    +1     
=======================================
+ Hits         9327     9330    +3     
  Misses         76       76           
Impacted Files Coverage Δ
src/sidebar/components/SidebarPanel.tsx 100.00% <100.00%> (ø)
src/sidebar/components/Slider.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@lyzadanger lyzadanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 🥳

@acelaya acelaya merged commit 7e35beb into main Apr 17, 2023
@acelaya acelaya deleted the sidebar-panels-autofocus branch April 17, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Screen reader does not move to Help text when the Help button is expanded
2 participants