AnthyG / ThunderWave

A chat for ZeroNet
http://127.0.0.1:43110/1CWkZv7fQAKxTVjZVrLZ8VHcrN6YGGcdky/
15 stars 3 forks source link

Toggle dropdown when Clicking on button (even when dropdown's already active) #92

Closed krixano closed 6 years ago

krixano commented 6 years ago

Before, you weren't able to click on the already focused menu button to hide the dropdown. Now you can! Note that code organization may not be how you want it.

Tested in Edge, Firefox, and Chrome on laptop. Not tested on mobile. Tried to test in IE 11, but JQuery isn't working for it (got $ is undefined error).

I did have to remove the dropdown-toggle class from the menu button because the :focus css stuff was messing with the functions I used.

AnthyG commented 6 years ago

Will merge it tomorrow.

AnthyG commented 6 years ago

In theory, you could swap out the id with a class, as that would make it much more usable. 🔀

krixano commented 6 years ago

I can't use the dropdown-toggle class because the CSS with the :focus messes up with the active class. The active class is removed when clicking on the button (to make the dropdown disapear), but the button is still in focus, so the dropdown doesn't disappear.

So, to make it work, I could do one of the following:

AnthyG commented 6 years ago

Yeah, just use a different class-name ;)

AnthyG commented 6 years ago

Merged to private_chats-Feature-branch: https://github.com/AnthyG/ThunderWave/commit/6c1e1faf6296bb259018ef07712339c30459b5e0