3 ms·
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
by dawnerd 5y 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.
- runarberg 5y agoI 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.
- cabalos 5y agoElement visibility should not be triggered via focus or hover. Visibility states should be triggered with a button click or enter key press.
- runarberg 5y agoIndeed, 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.