Better support for no JS in design system #109
Labels
a11y
Digital accessibility.
bug
Something isn't working
prioritization-required
This issue needs to be prioritized for future releases.
Describe the bug
When complex web components are used from the design system, and Javascript is disabled, those web components continue to partially render to the screen. For example, consider the following usage of
<cod-card>
.Notice how the second instance of the card does not include the button, effectively making it non-functional.
To Reproduce
Steps to reproduce the behavior:
javascript.enabled
and set to false).Expected behavior
Only the HTML elements with
no-wc
class should be rendered on the page.Proposed Solution
Use
<noscript>
anddisplay: none;
to hide all web components when Javascript is disabled.More specifically:
wc
to all web components.<slot>
swc
andno-wc
that will house the web component and non-web component alternative respectively. Note: This is needed so that step 3 does not hide the non-web component elements as well.<noscript>
with<style> .wc {display: none;} </style>
in the design system head. E.g. this stack overflow answer. Thus, when javascript is disabled all web components will be hidden from display (also for screen readers).Alternatives Considered
Frankly, I haven't come up with any alternatives that work well for the example above.
The text was updated successfully, but these errors were encountered: