Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data-Toggle-Trigger-Off Not Working With CSS Selectors #94

Closed
austin-LL opened this issue Nov 12, 2020 · 5 comments
Closed

Data-Toggle-Trigger-Off Not Working With CSS Selectors #94

austin-LL opened this issue Nov 12, 2020 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@austin-LL
Copy link

Hello! I absolutely love this library, so thanks for your work on it.

I'm having an issue using CSS selectors with data-toggle-trigger-off. I've got a dropdown nav that uses easy toggle state, and then two levels of sub-menus that use it as well. I've made a codepen to show the problem in action: https://codepen.io/awinnett/pen/KKMbBMV?editors=1000

  • Dropdown nav
    • Level one trigger
      • Level two trigger
        • Level three trigger

In this case, I can open the dropdown, use the level one trigger to open the submenu with the level two trigger, and use data-toggle-trigger-off to get back to the menu with the level one trigger. However, if I go down to the level three trigger, I can't go all the way back to level one, because data-toggle-trigger-off stops working at that point at level two after that for some reason.

Thanks in advance for your help!

@Twikito
Copy link
Owner

Twikito commented Nov 13, 2020

Hi @austin-LL 👋

Great to read that you love this library! ❤️

Ok, this use case is quite tricky. Let me investigate.

@Twikito
Copy link
Owner

Twikito commented Nov 13, 2020

Oh man! I understood what's going on!

First you open the menu. Ok, nothing to report.
Then you open the list-level-two menu, so the data-toggle-trigger-off="#menu-2" inside will trigger off by toggling the same trigger.
Then you open the list-level-threemenu, but since the target is #menu-2, #menu-5, the list-level-two menu is a target, so the data-toggle-trigger-off inside of it will change its reference to that last trigger, and obviously doesn't work the way you want 😕

I've tried changing all the data-toggle-target inside the list-level-two menu by removing #menu-2 selectors, and it works as excpected, but not the animation 😕

I guess the solution should be to change the architecture for something more standard: a sub-menu contained inside its related menu item.

@Twikito Twikito added the help wanted Extra attention is needed label Nov 14, 2020
@Twikito
Copy link
Owner

Twikito commented Nov 15, 2020

Ok, I thought about an improvement that could help you.

Let me test it.

@Twikito
Copy link
Owner

Twikito commented Nov 16, 2020

Hey @austin-LL 👋

That new release seems to fix your issue: https://github.com/Twikito/easy-toggle-state/releases/tag/v1.15.1.

Can you confirm?

@austin-LL
Copy link
Author

Perfect, that took care of it! Thank you so much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants