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

Fix Animation button accessibility issues (fixes #15762, #15763, #15764) #15776

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

maureenlholland
Copy link
Collaborator

@maureenlholland maureenlholland commented Dec 18, 2024

One-line summary

As discussed with Tess, we'd like to keep the text visible on smaller screens to provide toggle animation button label

The above decision also helps make the label more visible for Windows High Contrast Mode

We also want to ensure the button is not overlapped by the sticky nav when focused

  • I used an AI to write some of this code.

Significant changes and points to review

Other approaches considered for icon-only toggle animation button label:

  • animated text reveal on hover
  • custom tooltip
  • HTML title attribute

Overall, the visible text label felt simplest and most accessible

Other approaches considered for focused button visibility:

  • set custom property with sticky navigation height and use scroll margin to keep focused button below the sticky nav (this did not work when banner was also on page)

Issue / Bugzilla link

#15762
#15763
#15764

Testing

Go to http://localhost:8000/en-US/ and check animation toggle button in hero section

  • Text label is visible when large screen is zoomed to 200%

  • Text label is visible when on smaller tablet/mobile screens

  • Test in Windows High Contrast Mode to confirm button focus color is correct and border color is visible

(Polypane testing with forced colors)
Focused & not focused
Screenshot 2024-12-19 at 10 44 35 AM
Screenshot 2024-12-19 at 10 44 43 AM

  • With no motion pref, tab past the hero section, then tab back. The animation toggle button should be visible over top of the sticky navigation
  • When button is not focused, the sticky nav is on top

Focused button above sticky nav
Screenshot 2024-12-19 at 9 58 45 AM

Not-focused button below sticky nav
Screenshot 2024-12-19 at 10 00 40 AM

@maureenlholland maureenlholland requested a review from a team as a code owner December 18, 2024 19:39
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.07%. Comparing base (d49d532) to head (d41aaf8).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15776      +/-   ##
==========================================
+ Coverage   79.06%   79.07%   +0.01%     
==========================================
  Files         160      160              
  Lines        8355     8359       +4     
==========================================
+ Hits         6606     6610       +4     
  Misses       1749     1749              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


// Focused control is not hidden under sticky nav: https://bugzilla.mozilla.org/show_bug.cgi?id=1936862
&:focus {
scroll-margin-top: var(--sticky-nav-height);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

scroll margin experiment, don't think I'm going to use it, only seems to work with no banner and it doesn't seem worth adding up the nav & occasional banner heights

I think that leaves me with a z-index override option? open to other ideas

@maureenlholland maureenlholland added the WIP 🚧 Pull request is still work in progress label Dec 18, 2024
@maureenlholland maureenlholland force-pushed the add-title-for-animation-button branch from 769fce1 to 99bde00 Compare December 19, 2024 14:50
@maureenlholland maureenlholland changed the title Fix Animation button accessibility issues (fixes #15762, #15763) Fix Animation button accessibility issues (fixes #15762, #15763, #15764) Dec 19, 2024
@maureenlholland maureenlholland added Needs Review Awaiting code review Review: XS Code review time: up to 30min a11y Issues related to accessibility Frontend HTML, CSS, JS... client side stuff and removed WIP 🚧 Pull request is still work in progress labels Dec 19, 2024
@@ -63,6 +69,16 @@
&:active {
background-color: $m24-color-dark-mid-gray;
}

// High Contrast Mode Support: https://bugzilla.mozilla.org/show_bug.cgi?id=1936865
@media (forced-colors) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we could also make these changes site-wide for buttons in forced-colors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Issues related to accessibility Frontend HTML, CSS, JS... client side stuff Needs Review Awaiting code review Review: XS Code review time: up to 30min
Projects
None yet
1 participant