You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browser: all browsers, and all assistive technology
Possible solution(s)
Elsewhere in Flarum this is solved by adding an aria-label to the button, like the aria-label="View notifications" from the flagged posts notice:
A better alternative to aria-label, and my preferred approach (aria should be avoided unless it's genuinely unavoidable - see The first rule of using aria), would be to stick with your existing CSS-only approach, but to use an accessible technique, as described in Kitty Giraudel's article above.
That would put it slightly out of step with the rest of Flarum. Flarum does already have an accessible .sr-only class that could just be applied to the same span as .Button-label, but it doesn't seem to be getting used on buttons anywhere in the header bar at the moment (imo it should be! but that's a bit out of scope for this issue, heh).
Additional context
I'm very very new to Flarum, and I don't know how to make this happen for you in a PR. I would like to! It's out of my capability right now, but if either of my suggestions are accepted I'll be studying the update closely 😄
The text was updated successfully, but these errors were encountered:
Bug Report
Current Behavior
There's no accessible name for the button toggle. Here's the output code, from js/src/forum/addSettingsItems.js, lines 129 onwards:
<button class="Button Button--flat hasIcon" type="button"><i aria-hidden="true" class="icon fas fa-adjust Button-icon"></i><span class="Button-label">Toggle forum theme</span></button>
I see that the
.Button-label
span is intended to be the accessible name, but the CSS sets it todisplay:none;
:@media (min-width: 768px) { .Header-secondary .Header-controls > .item-nightmode .Button-label { display: none; } }
... this unfortunately removes the element entirely from the accessibility tree by design, so it never reaches its intended audience 😅
Expected Behavior
Screen reader users are able to understand what the button is for, and voice input users are able to target it.
Screenshots
![Screenshot 2024-09-08 at 14 41 16](https://private-user-images.githubusercontent.com/1948361/365442109-bb69fa33-dd58-4a39-916c-301a4ca92c8c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzEwMDEsIm5iZiI6MTczOTE3MDcwMSwicGF0aCI6Ii8xOTQ4MzYxLzM2NTQ0MjEwOS1iYjY5ZmEzMy1kZDU4LTRhMzktOTE2Yy0zMDFhNGNhOTJjOGMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMDY1ODIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzQ2NTczN2ZjMGY4Mjg5ZTdmZGIxNmQ5MjQxMTkyYWUyZGE5YjQyNjA0MTM0NDQ5ODlhY2VkNTVjZTg1OWY0NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.h5tcRT_wOETenjhWDumSV7uy99EoVUb8zj5exlBhmPA)
You can also verify this by using the axe accessibility dev tool. Here's a screenshot:
Environment
Possible solution(s)
Elsewhere in Flarum this is solved by adding an aria-label to the button, like the
aria-label="View notifications"
from the flagged posts notice:<button class="Dropdown-toggle Button Button--flat" aria-haspopup="menu" aria-label="View notifications" data-toggle="dropdown" title="Flagged Posts"><i aria-hidden="true" class="icon fas fa-flag Button-icon"></i><span class="Button-label">Flagged Posts</span></button>
A better alternative to
aria-label
, and my preferred approach (aria should be avoided unless it's genuinely unavoidable - see The first rule of using aria), would be to stick with your existing CSS-only approach, but to use an accessible technique, as described in Kitty Giraudel's article above.That would put it slightly out of step with the rest of Flarum. Flarum does already have an accessible
.sr-only
class that could just be applied to the samespan
as.Button-label
, but it doesn't seem to be getting used on buttons anywhere in the header bar at the moment (imo it should be! but that's a bit out of scope for this issue, heh).Additional context
I'm very very new to Flarum, and I don't know how to make this happen for you in a PR. I would like to! It's out of my capability right now, but if either of my suggestions are accepted I'll be studying the update closely 😄
The text was updated successfully, but these errors were encountered: