Improve accessibility of toggle buttons with contextual aria-labels#1063
Merged
johnbillion merged 8 commits intojohnbillion:developfrom Feb 5, 2026
Merged
Conversation
Contributor
Author
|
I have fixed the issue mentioned above. |
Owner
|
Thanks for the PR @Ankita19Rathore . I'll take a look soon. |
Contributor
Author
|
Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
This pull request improves the accessibility of the "Toggle more information"
buttons used in the HTML output by making their aria-labels contextual and
descriptive.
What was happening before
Previously, all toggle buttons were created using the following aria-label:
aria-label="Toggle more information"
Because this same label was used everywhere, screen readers announced
multiple buttons with identical text. This made it difficult for users
to understand what each toggle button would expand or control.
What was changed
The
build_toggler()method was updated to accept an optional$contextparameter.
Before:
After:
Behavior after this change
If context is provided, the aria-label becomes descriptive
(e.g.
Toggle more information about Jetpack hook callback).If no context is provided, the original behavior is preserved.
Why this change is important
Screen reader users rely on aria-labels to understand interactive elements.
Using repeated generic labels reduces accessibility and usability.
By introducing contextual aria-labels, each toggle button can now be
clearly distinguished, aligning with accessibility best practices.
Scope and safety of change
build_toggler()method only.