4 ms·
The pure-css effects I mentioned both don't use <detail>/<summary>.
by tapirl 9mo ago
The pure-css effects I mentioned both don't use <detail>/<summary>.
- jakelazaroff 9mo agoSame caveat applies to the "checkbox hack" or any other pure CSS solution. You cannot create accessible versions of most complex controls like tabs without JavaScript. (That first example could be created semantically and accessibly with <details> / <summary> though!)
- tapirl 9mo agofor "accessible", do you mean getting focused when pressing TAB key?
- jakelazaroff 9mo agoHere is a non-exhaustive list of issues you'll run into with various pure HTML and CSS implementations: - Tabs should have an ARIA "tab" role [1], but <summary> doesn't accept roles [2]. - Focusing a tab must activate the corresponding tab panel [3], which requires JavaScript. - Tabs should be navigable by arrow keys [4], which also requires JavaScript. I want to be clear that I'm not trying to tear down your work. Your project looks cool and eliminating JavaScript is a noble goal. But unfortunately, as of today, it's still required to correctly build most complex controls on the web. [1] https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/tab_role https://developer.mozilla.org/en-US/docs/Web/Accessibility/A... [2] https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/summary#technical_summary https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/... [3] https://w3c.github.io/aria/#tab https://w3c.github.io/aria/#tab [4] https://www.w3.org/WAI/ARIA/apg/patterns/tabs/ https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
- nextaccountic 9mo agowhat about, make it work in pure html and css, and enrich it with js to make it accessible? rather than not working at all with js disabled
- jakelazaroff 9mo agoThat's actually a common strategy called "progressive enhancement". The only thing is that your order is backwards: you should first make it accessible in pure HTML and CSS, and then use JavaScript to layer your fancy interactions on top. So, for the tabs example, your baseline pure HTML and CSS solution might involve showing the all tab panels simultaneously, stacked vertically. Once the JavaScript loads, it would rearrange the DOM to hide all but one and add the tab-like behavior.