-
Notifications
You must be signed in to change notification settings - Fork 45
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
Donate Block: Accessibility improvements #1622
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The styling of the tiers-based layout is broken – here's a before and after:


The interaction with this version of the block is broken, too:
The frequency-based version works as intended, though! Someday it'd be great to change the markup to remove the radio inputs entirely. This hacky markup was necessitated by AMP, which we don't support anymore. The block can have sane markup with JS-based interaction.
src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-frequency-based.php
Outdated
Show resolved
Hide resolved
35223ca
to
60d7bca
Compare
Thanks so much @adekbadek! The code updates should all be done.
Gah, good catch! Part of this was definitely the CSS changes I added (the messed up looking tabs), and part of it was me not rebasing master and pulling in the fix for the multiple-selected issue -- both should be fixed! 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me! The only bug I saw is a pretty rare edge case that's only in the editor (doesn't affect the front-end at all), so let's consider it non-blocking. To replicate:
- Set default donation settings (in Reader Revenue > Donations) to tiered and allow all three tiers.
- Set the block to Frequency layout and note the default tab, and leave that one active.
- Turn on "Configure manually", then disable the frequency that was the default in step 2. Observe that the block gets put into a state with no active tab (after doing this you might have to toggle off/on "Configure manually" a couple of times to get it to happen):

This limbo state is easily fixed by clicking on a tab or saving and refreshing the browser, so it's a very minor issue.
Thanks @dkoo! I've spun up a separate issue to dig into that weird editor state -- that's a great catch! I'm going to go ahead and merge this for now, and will address that in the next sprint! |
🎉 This PR is included in version 2.5.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [2.5.0](v2.4.0...v2.5.0) (2024-01-08) ### Bug Fixes * avoid duplicity with linked guest authors ([#1632](#1632)) ([608979c](608979c)) * **modal-checkout:** show order details table with fees ([#1633](#1633)) ([07c0642](07c0642)) ### Features * accessibility improvements to the donate block tabs ([#1622](#1622)) ([115e9fb](115e9fb)) * **donate:** support empty value for "other" tier ([#1604](#1604)) ([61ffdbc](61ffdbc)) * **modal-checkout:** allow anonymous purchase for registered email ([#1615](#1615)) ([a0040b4](a0040b4))
🎉 This PR is included in version 2.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
This PR makes accessibility improvements to the Frequency layout version of the Donate block, specifically to make sure the tabs have the correct markup and attributes, and can be navigated in a predictable way via keyboard.
The tabs have been added on top of the existing radio button logic that the block used, to try to minimize the changes being made.
See 1200550061930446-as-1203715106299306 and 1200024937525366-as-1202002498910398
How to test the changes in this Pull Request:
npm run build
.Default:

Alternate:

Minimal:

These are the specific accessibility improvements that were added in this update:
role="tab"
, and all three are wrapped in a parent element with the attributerole="tablist"
.aria-controls
attribute that has the ID of its associated panel, and each panel has an ID and anaria-labelledby
attribute that has the ID of its associated tab.aria-selected="true"
; if not, it will have the attributearia-selected="false"
tabindex="0"
.Other information: