cferdinandi/astro

'selector' as an option isn't applied to the menu

Closed this issue · 1 comments

m-e-h commented

https://github.com/cferdinandi/astro/blob/master/src/js/astro.js#L177

btw, thanks for all the inspiring vanilla js work!

From the docs:

Note: If you change the selector, you still need to include the [data-nav-toggle] attribute in order to pass in the selector for the navigation menu.

It is applied when checking to see if the clicked element was the toggle, but not for getting the ID of the navigation to expand/collapse. If the toggle was always a link, I could just use the href, but since it could also be a button, the only way to appropriately pass in the ID of the navigation is to use a data attribute.

So, in a kind of pointless move, you can set the selector to be anything you want, but there must be a [data-nav-toggle] attribute as well.