Created this fully "accessible" dropdown using pure Tailwind CSS 🤩
@surjithctly10K followers
169,734 views
78 Comments
Comments from the original post on X (Twitter)

@surjithctly
The correct answer is :focus-within ✨ People who guessed it right → @Xewl @cometkim @czechhater @szympajka 👏 Check out the code here 👇
20 likes

@colmtuite
@tailwindcss It's not possible to build an accessible dropdown without JS. I recommend using Radix or React Aria.
11 likes

@surjithctly
@tailwindcss Yes, true. This is Keyboard accessible I meant.

@okonetchnikov
@colmtuite @tailwindcss Tab isn’t the right key of making a select accessible with a keyboard. Please don’t ship this to production since it will confuse lots of people.
5 likes

@surjithctly
@colmtuite @tailwindcss Yes, there are some limitations because this is a CSS only proof of concept.

@shrutibalasa
@tailwindcss Checkbox hack? Using peer-* utility classes I guess
6 likes

@surjithctly
@tailwindcss Found a better way 😉
3 likes

@MedMYA
@shrutibalasa @tailwindcss Is it :focus?
2 likes

@surjithctly
@shrutibalasa @tailwindcss You are close :) Check out the code here 👇
2 likes

@shrutibalasa
@MedMYA @tailwindcss Really nice!
1 like

@pbteja1998
@tailwindcss Probably <details> and <summary> Atleast that’s what I use for these type of things.
5 likes

@surjithctly
@tailwindcss Its possible, but closing by clicking outside will be nightmare :)
2 likes

@amy_ndy
@tailwindcss How do you update the aria-expended without js ?
4 likes

@surjithctly
@tailwindcss Keyboard accessible 🙈

@Levous_io
@tailwindcss Mind sharing the code? I'm interested what approach you used
3 likes

@surjithctly
@tailwindcss Sure

@mo_souley
@tailwindcss Purposely not sharing the code ?
3 likes

@surjithctly
@tailwindcss Nope, Check out the code here 👇
1 like

@TimGuignard
@tailwindcss Not really related to your question but which software do you use to show keyboard keys while taking the video screenshot?
3 likes

@surjithctly
@tailwindcss Cleanshot.
2 likes
























