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

Fix navigation: close open dropdown on click of toggle item. #4566

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

edlerd
Copy link
Contributor

@edlerd edlerd commented Sep 29, 2022

Signed-off-by: David Edler david.edler@canonical.com

Done

Fix navigation: An open dropdown should be closed on click of toggle item.
Dropdown would always stay open before, no matter how often you click on the toggle.

@webteam-app
Copy link

Demo starting at https://vanilla-framework-4566.demos.haus

@edlerd edlerd force-pushed the navigation-script branch 2 times, most recently from 184be58 to bb9c059 Compare September 29, 2022 12:51
closeAllDropdowns(toggles);
} else {
closeAllDropdowns(toggles.filter((item) => item !== toggle));
toggleDropdown(toggle, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need both closeAllDropdowns(toggles.filter((item) => item !== toggle)); and toggleDropdown(toggle, true);?

First line seems to close all OTHER toggles, so should be enough without "reopening" current one in second line.

Or you could always close all dropdowns, but reopen only if it wasn't open:

closeAllDropdowns(toggles);

if (!wasOpen) { toggleDropdown(toggle, true) }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, if click-target was not open, we close all others and open it.

The alternative you mention is to always close all and open the click-target if it was not open. That is how I had it initially committed. I understood your comment above, that this alternative is redundant. Because it closes the click-target and then opens it again.

Now I am a bit confused. Do we want to have this redundancy in close-and-immediately-reopen, or do we want to avoid it?

… would always stay open before.

Signed-off-by: David Edler <david.edler@canonical.com>
@bartaz bartaz merged commit fcd5978 into canonical:main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants