Uikit: Nav dropdown does not hide after click on item

Created on 22 Dec 2019  路  3Comments  路  Source: uikit/uikit

UIkit Version

Check if the issue is reproducible with the latest stable version.
3.2.6

Actual Behavior

in a nav with a dropdown after clicking on a dropdownitem the dropdown does not hide.
It only hides if I do an extraclick outside the dropdown area. This is a problem, because there other click sensitive stuff can be.

Expected Behavior

As in former versions after clicking the menu item in the dropdown, the dropdown should hide.
in this version it still worked (dropdown disappearead after click): uikit-3.0.0-rc26

Reproduction Link

A minimal Codepen that can reproduce the bug. Start with this Codepen template

Steps to Reproduce the Problem

  1. open https://getuikit.com/docs/nav#nav-in-navbar
  2. in the 'preview' tab hover over 'parent'
  3. the dropdown appears
  4. click on any 'Item'
  5. the dropdown does not hide ... thats the problem
! Bug

Most helpful comment

If you want an empty link to "hide" the dropdown, you'll need to give it the uk-navbar-dropdown-close class.

In UIkit 4 we will have to be more concise on what closes/hides things like Modals and Dropdowns.

All 3 comments

I just realized noticed this behavior as well. The last version I used where the dropdown would hide on click is 3.1.6.

It may have broken in version 3.2.4: "Fix show/hide behaviour in Drop component"

If you want an empty link to "hide" the dropdown, you'll need to give it the uk-navbar-dropdown-close class.

In UIkit 4 we will have to be more concise on what closes/hides things like Modals and Dropdowns.

Yeah. It is quite a bummer that clicking on a link inside a nav dropdown doesn't automatically close the dropdown :(

It's true that I can add the uk-navbar-dropdown-close class to a valid link (in the dropdown). And yeah, clicking on the link will close the dropdown.. but it renders useless the actual purpose of the link (i.e. to send the user to a new part of the application).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

papazetis picture papazetis  路  3Comments

danishiqbal4 picture danishiqbal4  路  3Comments

drmzio picture drmzio  路  3Comments

s1973 picture s1973  路  3Comments

peturh picture peturh  路  3Comments