3 ms·
I saw several posts about using `<details>` in this way, but none that fully implemented what I was looking for. So I implemented a site navbar that uses `<deta
by devadvance 5y ago
I saw several posts about using `<details>` in this way, but none that fully implemented what I was looking for. So I implemented a site navbar that uses `<details>` in two ways: for dropdowns, and for a sidebar.
A working reference implementation can be found here [1]. Additionally, I ended up using a version of this on my personal site [2]. This works on stable versions of Chrome, Edge, Firefox, and Safari.
One thing to be careful of when using `<details>` in interesting ways: accessibility. At a minimum, I encourage folks to make sure that screen readers work as expected.
[1] https://codepen.io/devadvance/pen/bGBvvWv https://codepen.io/devadvance/pen/bGBvvWv
[2] https://github.com/devadvance/devadvance.github.io/blob/master/_includes/2021-nav.html https://github.com/devadvance/devadvance.github.io/blob/mast...
- hyeomans 5y agoVertical scroll doesn’t work on Firefox Daylight 33 iPhone. So I open the menu and the the submenu and I can’t see the rest of the menu
- devadvance 5y agoIf longer menus are needed, it might be necessary to manually set `overflow: scroll` and hide the scrollbar.