Open r-a-y opened 5 years ago
Hello @r-a-y and tank you for reporting the issue.
In my opinion the offscreen technique is not appropriate, because the dropdown menu must be hidden also to assistive technologies when collapsed.
Using display: none
or visibility: hidden
is the easiest and appropriate way to hide the menu and avoid the flashing on page load.
Unfortunately this css properties cannot be directly added to the .dropdown__menu
class because:
display: none
will break the plugin functionality when cssTransitions
is set to true
,visibility: hidden
will break the plugin functionality when cssTransitions
is false
and the slide-down and slid-up animations are handled by jQuery,A possible solution would be to add a class (e.g. .dropdown_nojs
) to the dropdown to position it offscreen (like in your example) and let the plugin remove it right after initialisation.
Describe the bug When the page hasn't fully loaded, the dropdown menu can be visible.
To Reproduce Steps to reproduce the behavior:
Expected behavior The dropdown menu should not be visible unless it has focus.
Additional context I have the following CSS fix in a testing environment:
The "moving content offscreen" technique is from the WebAIM article - "Invisible Content Just for Screen Reader Users": https://webaim.org/techniques/css/invisiblecontent/
I'm not sure if this is the proper technique for menus. CSS Tricks has the following article on dropdown menus: https://css-tricks.com/solved-with-css-dropdown-menus/
They are using simply
visibility: hidden
anddisplay: none
. I don't necessarily think "display: none" is the best approach there. Would welcome your thoughts.Also worth noting from the comments section of the CSSTricks article are the following attempts at addressing accessible dropdown menus: