Giter VIP home page Giter VIP logo

Comments (9)

ryceg avatar ryceg commented on August 28, 2024 1

It's worth noting that the @prefers-contrast media query (:contrast-more in Tailwind) has support for both less and more, and might be a good option for making things more a11y friendly.

from skeleton.

ryceg avatar ryceg commented on August 28, 2024 1

We can use the formula listed on WCAG and test whether colours meet accessibility guidelines, and generate complementary "high contrast" colours. We'd also be able to provide users with this information while they're generating themes, which would be very helpful. I won't have time to dig into this just yet, so don't assign it to me in case someone else wants to have a crack at it, but I figured I'd at least put that idea out there so it's visible.

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

I've completed some tests regarding visual a11y. In short, it's not really about what color values are used, so much as how high the contrast ratio is. For our themes, the biggest offender is typically text on top of a primary or accent color.

Take this example, generated with https://huewind.jordantwells.com/

Screen Shot 2022-08-25 at 3 11 28 PM

Note there's not a particular swatch level (ex: 500) that the overlapping text flips from white to black or vice versa. Rather this is handled per shade and varies per each column. This will be hard handle programmatically and would require an insane effort to test every possible theme and component combination.

Instead, I propose we approach these challenges from a different angle. See below.

1.

We improve our global and component default styles as much as possible. Aiming to better accommodate for contrast. Take our global paragraph style for example, the contrast is way too low, but can be easily fixed:

main p { @apply text-base text-surface-500 dark:text-surface-400; }

Should be:

main p { @apply text-base text-black/80 dark:text-white/80; }

Results before vs after:

Screen Shot 2022-08-25 at 3 28 39 PM

Screen Shot 2022-08-25 at 3 28 47 PM

This provides a much better contrast ratio out of the box for both light and dark modes. Though obviously users can choose to customize further if they wish. Perhaps even going for full 100% opacity.

2.

We may need to recommend that if a11y is a focus, you should pin your design to use only light or dark, not toggle between both. The variance between the two modes means there's too many variables to keep up with. Plus focusing one mode makes it easier to define and override the default values. For example, if we only used dark mode for the Skeleton theme, we could use the following to improve button contrast:

.button { @apply !bg-primary-400 !text-black; }

Results before vs after:

Screen Shot 2022-08-25 at 3 34 33 PM

However, we should look to review each component and ensure it's possible to target styles in a global manner. The style above would affect ALL buttons, whether filled or outlined, which is not very visually appealing.

Screen Shot 2022-08-25 at 3 49 13 PM

Something like .button-primary-filled or .button-ghost would suffice. This could be added programmatically as well.

3.

Finally, we should provide at least one theme and set of stylesheets purpose-built for a11y. This could be our reference for best practices. Per this, most a11y-focused themes I've seen to to use high contrasting black/white theme with subtle color highlights for interactive elements (ex: buttons).

Here's a very monotone example:
https://labinator.com/wordpress-marketplace/lat-demo/

The ARIA APG site is also a great example:
https://www.w3.org/WAI/ARIA/apg/patterns/

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

I'd recommend we handle this after the built-in themes and modular stylesheet PR is merged to dev. This will make this process MUCH easier!

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

Note that the new proposed Button Refactor opens the door to handling button visual a11y by allowing for easier global overrides of styling:

#216

This takes us one step closer to supporting this!

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

Note that we've also updated the default typography to improve color contrast ratios. So a bit more progress here! One of the last big steps will be providing a11y friendly theme options, which we should try to include in the next release.

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

@ryceg Really great info to know! Thanks!

I am still relatively new to the a11y side of things, but trying to learn and improve. Any other tips are absolutely welcome, visual or otherwise.

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

https://twitter.com/vitalyf/status/1580017289868771328

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

With the following update going live tomorrow, I'm feeling confident in our visual a11y:

This doesn't meant things are perfect or 100% accessible, but rather that we're meeting the standards and quality expected when this ticket was created way back in August. I do expect we'll see additional updates and improvements as part of these tickets:

Likewise another dedicated a11y audit will be recommended prior to the v1.0 launch.

But for now, this ticket has served it's purpose.

from skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.