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

Rewrite technique C40 and associated example per discussion in #3026 #3112

Merged
merged 10 commits into from May 9, 2023

Conversation

dbjorge
Copy link
Contributor

@dbjorge dbjorge commented Mar 20, 2023

This PR updates C40 and its associated examples per the discussion in #3026. Particularly:

  • It specifies explicitly that the requirement for the two colors is 9:1, and updates the colors in the examples accordingly
  • It disclaims that the technique only guarantees that the SC will be satisfied if the entire indicator is overtop one single, solid background color
  • It removes use of dotted/dashed outlines in favor of a single example that uses 2px solid color bands
  • It adds a note warning of a gotcha related to outline: none that can come up when trying to implement CSS similar to the recommended example

I explored writing a second example using two 1px color bands offset slightly from the focused component. This type of indicator would pass in all the same scenarios as the first example, since the "adjacent contrast" test would be comparing against the same pixels that would have been background pixels for the first example. However, I didn't include an example because I didn't come up with a good technique for implementing it generally. The closest option I explored was along the lines of this:

*:focus {
  /* required to support correct positioning in the ::after style */
  position: relative;
  /* outer outline */
  outline: solid 2px #330000;
  outline-offset: 1px;
}
*:focus::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  /* inner outline */
  outline: solid 1px #E2E2F2;
  outline-offset: 1px;
}

...but I didn't feel comfortable with this as a general technique since it has issues with elements that can't accept ::after content (eg, many input types) and it can cause issues to override position so broadly like this.

If someone has a bright idea for a more generally appropriate implementation, I'd be happy to include it as a second example.

This is the first time I've made changes this substantial to a technique, please feel free to have at me with any suggestions to help make the style more consistent with other techniques :)

Closes #3026
Closes #3055
Closes #2469
Closes #2575
Closes #2470

Preview C40, preview C41

@dbjorge
Copy link
Contributor Author

dbjorge commented Mar 31, 2023

I think this should also cover #3055 and #2469

@dbjorge
Copy link
Contributor Author

dbjorge commented Apr 28, 2023

I've updated this to cover:

The other example I'd mentioned considering in the PR description (two 1px bands at a 1px offset) would no longer pass the updated AAA focus appearance, so it's good that we never ended up including it anyway.

techniques/css/C40.html Outdated Show resolved Hide resolved
@alastc alastc merged commit b77d818 into w3c:main May 9, 2023
1 check passed
@dbjorge dbjorge deleted the fix-3026-c40 branch May 16, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment