Hacker News new | ask | show | jobs
by dawnerd 1550 days ago
I've always wondered but never really investigated... do screen readers handle css-only drop downs well? We've always avoided it and instead used javascript to toggle aria attributes which seems very backwards.
1 comments

I think it depends on the implantation. I think it is more important that your drop down is keyboard accessible. I usually expand my menus with ":focus-within" as well as ":hover" and make sure that one element which is always visible is also focusable. That way you can tab to it and the menu expands.
Element visibility should not be triggered via focus or hover. Visibility states should be triggered with a button click or enter key press.
Indeed, you should probably just use "<details>" and "<summary>" for drop downs today (works perfectly without any javascript and have accessibility built in). CSS only dropdowns were a hack for an era before these elements were widely supported.