w3c / wcag

Web Content Accessibility Guidelines
https://w3c.github.io/wcag/guidelines/22/
Other
1.09k stars 246 forks source link

Contrast requirements pertaining to incidental non-interactive text #3418

Open scottaohara opened 12 months ago

scottaohara commented 12 months ago

Per the current wording of Contrast (Minimum) and its exception for Incidental text, this exception heavily implies that the text need to be part of a disabled inactive user interface component for the exception to apply.

user interface component is defined as

a part of the content that is perceived by users as a single control for a distinct function

this, and the notes that accompany it, don't appear to cover how one should consider non-interactive content / text that is not meant to considered presently applicable, i.e., should be considered incidental.

For instance, content that has purposefully been provided dimmed (low contrast) coloring, where the intent is to inform someone of the existence of the content, but it is not currently meant to be consumed in its current state.

Examples of this sort of text could be because certain information in a product's dashboard has been dimmed due to irrelevance to the user's current content settings. The inactive panels of a carousel - where the current panel is fully in view, but other panels in the carousel content set are dimmed/partially positioned off page. Or, a modal dialog's transparent backdrop partially obscures static text of the primary web page, reducing its contrast. As one last example, a block of 'preview' content, where towards the end of the preview text, the text's contrast gradually lowers prior to being cut off completely, where a control to expand the full text is then presented.

None of this static content really falls under the definition of "perceived by users as a single control for a distinct function" - but if not for that very tight definition, I'd question why this wouldn't be considered incidental text - especially if someone has gone to the trouble of also ensuring that the content which is meant to be incidental has also been marked up to convey this (e.g., using the inert attribute or aria-hidden=true).

JAWS-test commented 11 months ago

Perhaps the definition of pure decoration could be expanded to include your examples

detlevhfischer commented 11 months ago

@JAWS-test I do not see the examples given by @scottaohara as usefully lumped under pure decoration - things like fading text or fading (partially visible) carousel slides carry important information for users, so they are not decorative. The current SC text is just not fine-grained enough to cover these cases, which all seem relevant. (I guess at the time of writing, fading elements, skeleton loaders, dialogs with shading and the like weren't around.)

There was a related issue on skeleton loaders: #2048 - where I think some made the point that to the extent that skeleton content does convey information (something's being loaded) it should meet the non-text contrast requirement . Applied to fading content, it could be interpreted as "some (information carrying parts) of the content should have enough text / graphic contrast to stand in for the non-contrasty rest". So if the text starts with sufficient contrast on the first two or three lines and then fades out, that would be OK.

As the normative text is unlikely to be changed, it would certainly be helpful to add the examples Scott is giving and some rationale to the understanding text, perhaps in line with the bit in 1.4.11 that says "Parts of graphics required to understand the content".

Myndex commented 10 months ago

Hi @detlevhfischer and @scottaohara

The uses of text and the user needs for text are among the widest spectrums in terms of variation and what is best practice. WCAG 2.x SCs provide only sparse guidance here, partly by design to keep the SCs simple and testable in a binary way.

...Examples of this sort of text could be because certain information in a product's dashboard has been dimmed due to irrelevance to the user's current content settings...

Arguably this stated example falls under "inactive component", and in that case related WCAG 2.x SCs essentially absolve the content author of any specific level of contrast.

Taking a look at the SC (emphasis added):

  • Text or images of text that are part of an inactive user interface component, that are pure decoration, that are not visible to anyone, or that are part of a picture that contains significant other visual content, have no contrast requirement.

The "not visible to anyone" is one part of this that also addresses most of the examples you mention, in association with the inactive components clause. The non-foreground parts of a carousel, the dimmed text behind a modal, the fade-out preview text. All of these embody the "not visible to anyone" basis. But they are also all under user control: clicking to advance the carousel, clicking the modal, or buying a subscription.

The "normative" part of the SCs is what is in the SC itself. In the case of the carousel, the frame in view is the active frame, the others, partially obscured are inactive user interface components. This is true of the modal, when the modal is up front, blocking view, the modal is active and the blocked view is an inactive user interface component, and so is the text fading away.

Keep in mind that WCAG 2.x was designed/structured to be testable in a very binary way, and therefore must be simple. From a legal point of view, an element is either the foreground content to view (active) or it is background/ancillary (inactive). To be testable the way WCAG 2.x is written and structured, everything is essentially a binary pass/fail, these "gradient" examples notwithstanding.

It would be unreasonable to say that something has to cut off and can not fade out. The fade itself has meaning, and in the case of preview text fading out, the meaning is "hey you wanna read? You gonna pay!". The start of the dimming or fade out is the start of where it becomes an "inactive" component.

This is one of the topics we're working on for WCAG 3, which led to text use cases. In the present case of content that is intentionally suppressed, it would be categorized as either "sub-fluent" or "non-fluent". This is all an open discussion at the readability forum on GitHub you're welcome to discuss ways to handle these nuances.

...it should meet the non-text contrast requirement...

In order to make such fine distinctions, the contrast metric used needs to be perceptually uniform, and WCAG 2.x contrast is not at all uniform, and therefore not fit for such a purpose.

While I agree there should be standards for semi-suppressed content, WCAG 2.x contrast math is a blunt instrument that's only useable within a narrow range where the background is very light. 1.4.11 itself has no empirical support, and does not apply here in any case.