Skip to content
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

Does the adjacent color clause of SC 1.4.11 apply when focus changes swap colors but also are adjacent to the background ? #1775

Closed
mraccess77 opened this issue Apr 30, 2021 · 74 comments · Fixed by #2028 · May be fixed by #1788

Comments

@mraccess77
Copy link

mraccess77 commented Apr 30, 2021

I originally wrote this as a discussion question 21 days ago in this github repository but it has gotten no attention. So I'm posting here as an issue.

In the screenshot below the button background and page background are the same color. The focus indicator is communicated by a color change of the circular button to become darker. SC 1.4.11 doesn't require the focused and unfocused states to have contrast - but must the new focused color contrast with adjacent page background colors as well because the focus indicator takes up the whole button area?

image

For a circular button - what is considered the component rather than page background - is it the bounding box or the visible component?

@patrickhlauke
Copy link
Member

if i can't see/perceive the darker circle against the overall page background, I can't perceive the focus state. so to me yes the dark circle must contrast with 3:1 against the background. yes, we did say previously that we can't simply compare "focused state vs uncofused state", but the individual states themselves, when in effect, also still need to pass adjacent colour criterion for the bit that matters...which in this case, is the focus indicator.

@patrickhlauke
Copy link
Member

the bone of contention in the past was that you can't compare "focused vs unfocused" because unless you have both focused and unfocused components butting up right against each other, there's no "adjacent" colours to compare things to.

@mraccess77
Copy link
Author

@patrickhlauke I'm not suggesting we compared the focused and unfocused states - but asking if we need to compare the focused states colors to the adjacent background for this situation. Previously @alastc had said that an inset indicator that swapped colors would not be covered by SC 1.4.11 - but in this case it's not simply inset. Would it make a difference if the circle got larger when focused?

@patrickhlauke
Copy link
Member

patrickhlauke commented Apr 30, 2021

in the case you're showing in your screenshot, no, it wouldn't make a difference if the dark circle got larger (larger than what? the unfocused state has no circle?)

there's no "inset" here, as there's no visible outer boundary (when not focused). or am i missing something?

i.e. purely visually, there's no circle to start with. and when it receives focus, there's a dark blue circle that appears behind the icon to indicate it's focused. and that dark blue circle is necessary to understand the state of that control (that it is currently focused), so it needs to have sufficient contrast to any adjacent colours (the page background) for that to happen.

@patrickhlauke
Copy link
Member

patrickhlauke commented Apr 30, 2021

randomly, if somebody tried a "ah, but even when not focused, there's a blue circle already there, it's just that it happens to be the same colour as the background so you can't see it" smart-alec argument here, i'd say fine, this then fails 1.4.1 use of color, since you're changing this "preexisting circle" that isn't actually visible from blue to dark blue only...and the difference is less than 3:1

so either way you want to slice it, that dark circle needs to have a contrast of 3:1 or better against the blue colour of the background / the blue colour of the theoretically already there, but just not visible, circle

@mraccess77
Copy link
Author

@patrickhlauke I think this should fail because the swapped colors touch the adjacent page background - and I think it sounds like you agree - but I wanted to get others take on this because I'm not sure that's how others read it. I may have mis-read your 2nd comment when I replied above.

Do you agree with interpretation in the understanding that if the control had an inset indicator that swapped colors but did not reach the border then it would not be covered under SC 1.4.11?
Screenshot with inset focus indicator that never touches background colors of page and thus is not covered by SC 1.4.11
image

@patrickhlauke
Copy link
Member

patrickhlauke commented Apr 30, 2021

to clarify: your original example to me fails 1.4.11

now, your new example here to me also fails 1.411, as regardless of whether it's inset or not, that focus indicator of slightly darker blue still touches light blue adjacent colour, and has a ratio below 3:1, and being able to perceive the difference between the light and dark adjacent blues there is essential to understanding the state of the control.

if the whole "Test" button when focused changed just to that slightly darker blue, I'd pass this for 1.4.11 (as there would be no adjacent areas of dark blue touching light blue), but fail under 1.4.1 because it just uses a change of color to indicate focus

@mraccess77
Copy link
Author

Thanks @patrickhlauke - as a group we absolutely need to agree on these things as they come up almost daily and I've gotten different responses from the leaders in the Accessibility Guidelines working group.

@patrickhlauke
Copy link
Member

patrickhlauke commented Apr 30, 2021

FWIW i don't currently see anything in the understanding document that would contradict our take here (that both examples you provide fail 1.4.11). the different answers from people may be down to just talking theoretically about "what if it has an inset extra border" or some such, which may conjure up different mental images for different people? not sure...

@patrickhlauke
Copy link
Member

the one example that could possibly cause confusion about inset background colour etc is the second radio button here in https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html

series of radio buttons

in that second example, true the inside dark gray doesn't contrast enough against the lighter gray circle of the radio button, but it's not essential for the visual understanding here to see the contrast/differentiation between the original outer circle and the filled inside ... just that visually, this changed from an empty circle to a filled circle - so even if a sighted user perceives the second selected radio button like a solid one indistinguishable from the third radio button (where the fill is the exact same as the outer circle, so seamless), they can still visually perceive the state of selectedness that is different from the unselected first radio button.

to me, some of this hinges on a "if there was no contrast at all between these two colours that i'm not sure about, would a sighted user still be able to understand what's going on" every so slightly subjective take

@mraccess77
Copy link
Author

From the understanding doc:
In combination with 2.4.7 Focus Visible, the visual focus indicator for a component must have sufficient contrast against the adjacent background when the component is focused, except where the appearance of the component is determined by the user agent and not modified by the author.

@patrickhlauke
Copy link
Member

patrickhlauke commented Apr 30, 2021

ok, so i'm not seeing how that sentence would provide any doubt about whether your two examples would fail (unless there's some over-reading of what "adjacent background" is intended - to me that means "adjacent to the focus indicator" - not "adjacent to the component itself - so regardless of whether it's inside or outside of the component itself)

to put another way, only a weird reading of "we need to treat the component as an atomic entity, and can't take into consideration anything that happens inside it" would lead one to say that because of that sentence, both your examples don't fail. which would be quite obtuse, in my mind...

@detlevhfischer
Copy link
Contributor

I agree both of Jon's examples fail.

@alastc
Copy link
Contributor

alastc commented May 3, 2021

The odd threading we had to do with 1.4.11 was differentiating the more decorative 'states' like hover, from focus and things like selected for radio buttons.

My recollection is that we determined that we could cover things like 'selected' if focus was only covered if it is compared to adjacent colours from the component. The last example in the table covers that, "Checkbox - Subtle focus style - fail"

The example in the original post of this thread makes that harder to determine because the buttons only have 'content', (the icons) with no boundary/background of their own. Therefore for those icons:

  • The white needs to contrast with the blue background (Graphical Objects),
  • The focus indicator needs to contrast with the adjacent background, because it is adjacent to the background of the component.
  • The white icons must continue to contrast with their adjacent colours.

For the 'test' buttons above, I agree they suck, but I don't think they are covered by 1.4.11. That's one of the reasons for the adjacent-bullet in the new SC: "The contrasting area also has a contrast ratio of least 3:1 against adjacent colors in the focused component"

@patrickhlauke
Copy link
Member

patrickhlauke commented May 3, 2021

For the 'test' buttons above, I agree they suck, but I don't think they are covered by 1.4.11

how so? i don't see anything in 1.4.11 that would explicitly exclude this scenario - the darker blue and lighter blue inside the button need to be visually perceivable for a user to understand the state of the control (that it has focus). otherwise they'll just perceive it as having a solid blue background, which is the same as its unfocused state. sounds very much in line with

any visual information necessary to indicate state, such as whether a component is selected or focused must also ensure that the information used to identify the control in that state has a minimum 3:1 contrast ratio.

(from https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html#user-interface-components)

this is different from, say, the second selected radio button example (https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html#figure-three-radios), where even if the user can't perceive the difference between the filled-in inside circle and the outer ring, and just perceives it as a single solid dark circle, it's still visually different from the non-filled circle when it's not selected (so there it's not necessary to distinguish the two, as they're not visual information necessary to indicate state)

@alastc
Copy link
Contributor

alastc commented May 4, 2021

how so? i don't see anything in 1.4.11 that would explicitly exclude this scenario

Looking back, the conversation in #541 that lead to your PR in 1058.

@patrickhlauke
Copy link
Member

patrickhlauke commented May 4, 2021

no, that's irrelevant, because i'm not saying "compare the unfocused test to the focused test and calculate the contrast based between them". i'm saying in this case, the internal darker blue in that button doesn't have sufficient contrast against the lighter blue of that same button. so the colours here are adjacent (rather than comparing two states that are not on screen at the same time and adjacent)

@patrickhlauke
Copy link
Member

patrickhlauke commented May 4, 2021

Original test button - the focus indicator in this case fails 1.4.11 because it needs to be perceivable but lacks sufficient contrast

original test button where focus is indicated by a subtle additional internal border that doesn't contrast with the overall button background

If it was like this (slightly hacked together) case, where the whole of the background of the button changes, then yes that would be the case where 1.4.11 does not apply (which is what #1058 addressed) as there's nothing "adjacent" that fails (but it will still fail 1.4.1 Use of Color in this case, because the focus indicator relies on color alone and the difference between the unfocused and focused background colour, which for 1.4.1 do NOT need to be "adjacent", is < 3:1)

second example where the focused test button changes background altogether

@mraccess77
Copy link
Author

It was my understanding that color swaps like
image were not covered in SC 1.4.11 or SC 1.4.1 and that is why they were added to 2.4.11. If 1.4.1 already required > 3:1 then why are we addressing it in SC 2.4.11? I'm not opposed to failing it today under WCAG 2.0/2.1 but I've been given different guidance from this group of this very topic. It would then seem that we could use 1.4.1 to address all contrast issues with all focus indicators.

@patrickhlauke
Copy link
Member

It was my understanding that color swaps [...] were not covered in SC 1.4.11 or SC 1.4.1

not in 1.4.11, but why not in 1.4.1?

@patrickhlauke
Copy link
Member

2.4.11 is necessary because currently, even with 1.4.1 and 1.4.11 and the different situations they apply to, WCAG says nothing about how big/ "visible" a focus indication must be. in theory, a single 1x1 pixel contrasty indicator of focus passes focus visible and 1.4.11. 2.4.11 would patch THIS hole

@dotjay
Copy link

dotjay commented May 4, 2021

Just to weigh in here on the current situation with WCAG 2.1 (and sorry if this point has already been made). I find it confusing that the Understanding document for 1.4.1 Use of Color currently notes a requirement of a 3:1 contrast ratio as visual distinction (e.g. for a focus state versus at-rest state, where only a subtle change in the lightness of background colour would fail) yet technique C15, "Using CSS to change the presentation of a user interface component when it receives focus", is only an advisory and not required for conformance.

Edit: Sorry – also realised there may be a better issue under which to make this comment.

@mraccess77
Copy link
Author

Ok - so if SC 1.4.1 applies - then it should apply to both situations both the full color swap and also the swap of an inset rectangle as well. in SC 2.4.11 editor's draft we have "Contrasting area: There is an area of the focus indicator that has a contrast ratio of at least 3:1 between the colors in the focused and unfocused states." - is that still needed if covered by SC 1.4.1?

@patrickhlauke
Copy link
Member

when discussing 1.4.1 (need to find the reference, eluding me at the moment), we came to the conclusion that to take it to the extreme, anything that appears/disappears on a page can be counted as a "change of color" and we could end up failing everything under 1.4.1 - which is obviously pointless. so if an existing shape/thing changes color, then we consider it for 1.4.1. if it's a case like your circle background in the first example, or even the inset extra border in your second example, that "thing" wasn't there before, so 1.4.1 does not apply.

@mraccess77
Copy link
Author

@patrickhlauke with that reasoning of it not being there before would mean the full background swap on the button would then not be covered by SC 1.4.1 either - unless the two items were adjacent to each other like page tabs and then SC 1.4.11 could apply as well.

@patrickhlauke
Copy link
Member

well, if you're treating the test button there in its unfocused state not as a "blue button with a gray/black border on a blue background", but rather "an empty see-through button with no background and just a gray/black border on a blue background", sure. but this is now splitting hairs even more than i normally do...

@patrickhlauke
Copy link
Member

(randomly, did i ever mention that 1.4.1 Use of Color is also a magnificently wooly SC because it can be (mis)interpreted in so many different ways?)

@patrickhlauke
Copy link
Member

the above assumed you meant if the test button itself was on a blue background. but just this image, where they are on a white background

image

clearly the unfocused button does have a background (it's light blue). its focused state changes the background of the button (to dark blue). the difference in contrast between those two is < 3:1. 1.4.1 does not stipulate the colors need to be "adjacent", but talks about the change in color, and that if the difference is < 3:1, it's only treated as a change of color (hue), not brightness, which would be a secondary visual characteristic (and therefore not just a change of color alone)

@mraccess77
Copy link
Author

As I understand it the inset focus ring or indicator would be failed by 2.4.11 under the comparison to focused and non-focused states as well as in regards to adjacent colors. @alastc explained that 1.4.11 deals with adjacent background colors while SC 2.4.11 deals with internal component colors - or at least that's what I understand from him.

@patrickhlauke
Copy link
Member

1.4.11 deals with adjacent background colors

which seems to me where the bone of contention is ... as in my (and many other people's) reading of 1.4.11, it makes no difference if something is internal or external to a component ... if it's necessary to distinguish "the thing" for it to make visual sense to a user/make sure they can perceive it, and if they didn't manage to perceive it (be it an internal border, or extra circle, or whatever) they'd miss out on important information about the component or its state, then it would fail.

@mraccess77
Copy link
Author

Hi totally agree @patrickhlauke.

@patrickhlauke
Copy link
Member

randomly, as this issue has bubbled back into our consciousness ... it may also be interesting to note this sentence (just above Figure 4) https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html

For visual information required to identify a state, such as the check in a checkbox or the thumb of a slider, that part might be within the component so the adjacent color might be another part of the component.

focus is a state. and this sentence essentially states that in cases where the visual info is required to identify the state, it makes no difference whether it's "outside" of the component, or it's comparing adjacent colours inside the component itself.

@johnfoliot
Copy link

this thing about inside/outside a component came from @alastc's comment... which...not everybody seems to agree with (i certainly don't).

+1 I have never agreed with this interpretation

focus is a state. and this sentence essentially states that in cases where the visual info is required to identify the state, it makes no difference whether it's "outside" of the component, or it's comparing adjacent colours inside the component itself.

Precisely. At the end of the day, what is the impact on the end user? It should not matter (I will argue) how (or perhaps more precisely "where") the change of state is visually conveyed, that conveyance MUST have sufficient visual contrast to meet the needs of the user.

because there are simply too many states that you would need to contrast with each other. (16 for links IIRC.)

I've always felt this is something of a cop-out, where we've relaxed the 'burden' on the author by shifting it back onto the user. I disagree with that approach. What is "too many"? If, instead of "16" that number was 12 - would that be fewer than "too many"? What about 10? 8? 4?

As Patrick notes, focus is a state, and our current normative definition of state says:

State: dynamic property expressing characteristics of a user interface component that may change in response to user action or automated processes

States do not affect the nature of the component, but represent data associated with the component or user interaction possibilities. Examples include focus, hover, select, press, check, visited/unvisited, and expand/collapse.

I will note that there is no distinction in our current definition on whether the visual change of state is "inside" or "outside" of the component, nor whether some states are 'different' than others: hover is far more 'temporary' than, say 'visited', but at the end of the day, if the page author chooses to use color to differentiate a change of state, 'temporary' or otherwise, then sufficient contrast MUST be conveyed.

@patrickhlauke
Copy link
Member

I will note that there is no distinction in our current definition on whether the visual change of state is "inside" or "outside" of the component, nor whether some states are 'different' than others: hover is far more 'temporary' than, say 'visited', but at the end of the day, if the page author chooses to use color to differentiate a change of state, 'temporary' or otherwise, then sufficient contrast MUST be conveyed.

I'd grant that hover is slightly weird/has extra nuance. If there's visual styling to just indicate "yes, you're hovering this control", and if was already clear that the thing was a control (i.e. it's not through hover that the control is indeed "revealed"), then even if the indication had relatively low contrast, arguably a user can still see their mouse pointer and know that they're over the control/thing. If however on hover the whole component becomes unreadable/unrecognisable due to too low contrast, that will indeed be a problem in my book. so it comes back down to...context, as ever. nuance, the enemy of simple clear-cut rules...

@johnfoliot
Copy link

+1 Patrick, although I also note that hover (onHover) is essentially just a variant of focus (onFocus), and in fact I would expect that a site or page would have both (else that's a failure of a different sort I suspect).

Nonetheless, I continue to advocate for the interpretation that any visual indication of a change of state MUST also meet color contrast requirements - and I fundamentally reject the argument that there are too many states that you would need to contrast with each other. (There may be 16 or more possible combinations, but I'd be extremely surprised to see a site using ALL of those potential 16 combinations)

@patrickhlauke
Copy link
Member

+1 Patrick, although I also note that hover (onHover) is essentially just a variant of focus (onFocus), and in fact I would expect that a site or page would have both (else that's a failure of a different sort I suspect).

if a site applied a super subtle change of, say, background colour on a link, which barely contrasts at all against the page background, on hover, i'd not fail it because it's a bit of eye candy (for those that can perceive it) and nothing is lost for users even if that change wasn't there. obviously, if they did the same for focus, that would be a failure in my book as a keyboard user needs to know where their focus is (a mouse user knows where they are because...they have a mouse pointer). [all other things being equal, as said...if instead it was more "everything looks like static text, and only by hovering over stuff and observing any change in presentation do you understand that something is actionable/clickable, then yes i would fail for low contrast, assuming mouse cursor doesn't change either and the subtle change in background is indeed the only visual cue ... in that case, it's essential to be able to perceive that change, and it therefore must meet minimum 3:1 ratio).

@alastc
Copy link
Contributor

alastc commented Jun 29, 2021

Update from the meeting today: https://www.w3.org/2021/06/29-ag-minutes.html#item06

Summary: The internal adjacency aspect could be read either way (to component or to indicator), but applying it inside the component creates other problems for states such as hover/visited etc. It would add quite a lot of new things that would fail 1.4.11. Not necessarily focus, but other states.

Several people will get together to review the 1.4.11 understanding doc to clarify this.

@patrickhlauke
Copy link
Member

patrickhlauke commented Jun 29, 2021

i thoroughly disagree with this decision, if it means that cases like

two light blue buttons - the one that is focused has a slightly darker blue circle

and

two light blue buttons - the focused one has a slightly darker blue internal extra border

(whether the second state is one of focus, or in the case of toggles, when that second state is the pressed/selected state, etc) are then considered to PASS 1.4.11. ridiculous. those are different states, and sighted users need to be able to perceive the difference in state. it's essential for their understanding of the component. with contrast being so low, they won't. so a user may not know if that button/toggle is focused, or pressed, or whatever. visited and hovered are different, as they're usually "nice to have but not essential".

@patrickhlauke
Copy link
Member

and, as previously noted, 1.4.11's understanding already mentioned internal background in places like

The toggle button's internal background (#070CD5) has a good contrast with the external white background. Also, the round toggle within (#7AC2FF) contrasts with the internal background.

so talking of "historical" interpretation, as if this idea of internal background was somehow new and introducing excessive new burdens, seems odd.

@patrickhlauke
Copy link
Member

actual live examples here https://codepen.io/patrickhlauke/pen/ZEKYYRe (showing two variations of focus indicator that's "inside" the component, and one case where an element "inside" the component is used to denote a toggle that's on/off). is the rest of the group saying that these are all kosher under 1.4.11?

@alastc
Copy link
Contributor

alastc commented Jun 29, 2021

And if that style were used on hover, should that trigger a a failure as well? You can't decide to "not fail it because it's a bit of eye candy" in one case but not the other.

@patrickhlauke
Copy link
Member

patrickhlauke commented Jun 29, 2021

it's eye candy on hover because you know where your mouse pointer is... a user doesn't need the hover to be able to tell where their pointer is. compare to focus where the indication is essential, otherwise the user won't know where their focus is (if nothing else is there)

@patrickhlauke
Copy link
Member

IF the element only reveals its actionable nature on hover, then it's not just eye candy, and then yes it would fail then as well if that was the only information provided to a sighted user that the thing they're over is actionable (if it didn't look like a button at all to start with, and reveals its button-like nature only on hover). then it's "required to identify user interface components"

@patrickhlauke
Copy link
Member

also, what people seem to be objecting to here is the "inside the component" aspect. are you now also arguing that you would not consider hover at all as a state, even if outside? or is the fact that it's inside the component giving you an out to now question other states like hover?

@patrickhlauke
Copy link
Member

in any case, i'd be very interested in folks looking at https://codepen.io/patrickhlauke/pen/ZEKYYRe and seriously suggesting all those are cases where 1.4.11 should not apply and it's all fine according to WCAG, because in my own testing these are all cases that i have already (historically) failed.

@patrickhlauke
Copy link
Member

patrickhlauke commented Jun 29, 2021

added a hover example to https://codepen.io/patrickhlauke/pen/ZEKYYRe as well, a case where yes it would fail because it's essential to see the hover styling. again, it comes down to a fairly simple question to decide if something's eye-candy or not: if that particular thing wasn't there at all, would a user still understand the content/state? if not, it's essential, and if that then has too low adjacent contrast (whether it's inside or outside) and can't be distinguished/seen, it's a fail.

@patrickhlauke
Copy link
Member

And if that style were used on hover, should that trigger a a failure as well? You can't decide to "not fail it because it's a bit of eye candy" in one case but not the other.

you can decide if it is or isn't eye candy by asking "if this wasn't there, would the user still understand what's going on?" to then determine if it's "required to identify user interface components and states"

@patrickhlauke
Copy link
Member

Several people will get together to review the 1.4.11 understanding doc to clarify this.

could i request to be part of that group of several people please? assuming it's possible to work asynchronously on it

@mraccess77
Copy link
Author

mraccess77 commented Jun 29, 2021

I'd like to see these as failures as well - but I wanted the group to address the fact that the documentation had said something else. Some sort of acknowledgement of the change in understanding. One option was to make this change clear for 1.4.11 in WCAG 2.2.

I agree the toggle switch example in the understanding document makes it clear that internal adjacent colors can and need to be included.
image (screenshot showing blue switch with light blue circle inside of it).

@detlevhfischer
Copy link
Contributor

detlevhfischer commented Jun 30, 2021

you can decide if it is or isn't eye candy by asking "if this wasn't there, would the user still understand what's going on?" to then determine if it's "required to identify user interface components and states"

It seems to me that not knowing whether something is an interactive element without hovering over it would be a general usability problem. If anywhere, it would belong to some future 'affordance' SC that so far has not seen sufficient support or testing feasibility to make it into a draft.

I think of the examles in the @patrickhlauke's codepan, 1-5 clearly fail 1.4.11: The indication of state (whether focus or activation) is compared to the adjacent color and found insufficient. If there is something in the 1.4.11 Understanding text that could be interpreted as making internal state indicators exempt, it should be removed. In terms of focus, example 6 seems more like a general usability problem - it depends on the context whether the element would be perceived as an interace component (It probably would be if the element was on a map and there would be a text above saying "You can toggle map view and satellite view"). It would still fail 1.4.11 for lack of contrast in terms of activation state.

@alastc
Copy link
Contributor

alastc commented Sep 7, 2021

Hi Folks, another update from the call, where this update in #2028 was approved.

I think that closes this issue, but I'll leave it open for a few days in case anyone on this thread would like to chip in.

@patrickhlauke
Copy link
Member

#2028 tackles the focus aspect, but as mentioned, I think the same rationale/discussion also applies (in combination with use of color) to other states like pressed. may open a separate discussion on that wider topic...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.