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
{{ message }}
Repository navigation
a11y: an undecidable <style> rule that can only show an element makes every element it could match unconfirmed #940
Since #921, the a11y checks that skip hidden controls read the page's <style> blocks. They do not decide a rule whose selector has a combinator, a pseudo-class or an at-rule around it. Such a rule makes every element its subject could match "unknown", and so <check>-unconfirmed. That is right when the rule could hide an element. It is too cautious when the rule's declarations can only show one, for example display: inline-block, display: flex or visibility: visible.
WordPress core block CSS has two such rules: .wp-block-image>a,.wp-block-image>figure>a{display:inline-block} and .wp-lightbox-container button{...;display:flex;...}. On a page that carries them, every <a> and every <button> is unknown. On the github.blog homepage, a 20-page quick offline audit after the #938 fix has these results:
a11y/button-name, a11y/aria-labels and a11y/aria-command-name report the page's unnamed buttons as unconfirmed, while 19 other pages fail.
a11y/aria-hidden-focus reports 196 focusable elements as unconfirmed.
A rule that can only show an element changes nothing for an element that would be shown anyway. It matters only where something else hides the element:
the hidden attribute, a closed <dialog> or a popover;
a decided display: none;
an inherited visibility: hidden.
There it may show the element, and "unknown" is right.
Acceptance Criteria
On an element nothing else hides, a <style> rule the reader cannot decide, whose readable declarations only show (a display value other than none, or visibility: visible), leaves the element shown, not unknown.
The same rule on an element that is hidden by the hidden attribute, a closed <dialog>, a popover, a decided display: none or an inherited visibility: hidden still makes it unknown (unconfirmed), never shown.
An undecidable rule whose declarations could hide (display: none, visibility: hidden, an unreadable value) keeps making the elements it could reach unknown.
Every row of packages/rules/tests/fixtures/static-hidden-chromium.json keeps passing. New rows, rendered in headless Chromium, cover the WordPress .wp-block-image>a and lightbox button shapes.
A 20-page quick offline audit of github.blog no longer reports the homepage's unnamed buttons as unconfirmed only because of those two rules.
Activity
fix(rules): a11y style rules that only show an element no longer make…
fix(rules): a style rule that can only show an element no longer leav…