Semantic-ui: Links in menu dropdowns not working

Created on 23 Oct 2015  路  5Comments  路  Source: Semantic-Org/Semantic-UI

In atleast 2.0.0-2.1.4

It is not possible to make links, and with that i mean -tags under .ui.menu .dropdown, basically means i'm using 100lines of my own code to make a top navigation work, not nice!

Changing in example: http://semantic-ui.com/examples/fixed.html

..
      <a href="http://semantic-ui.com/examples/fixed.html#" class="ui simple dropdown item">
        Dropdown <i class="dropdown icon"></i>
        <div class="menu">
          <div class="item">Link Item</div>
          <div class="item">Link Item</div>
          ..
        </div>
      </a>
..

to

..
      <a href="http://semantic-ui.com/examples/fixed.html#" class="ui simple dropdown item">
        Dropdown <i class="dropdown icon"></i>
        <div class="menu">
          <a href="#" class="item">Link Item</a>
          <div class="item">Link Item</div>
          ..
        </div>
      </a>
..

or to

..
      <a href="http://semantic-ui.com/examples/fixed.html#" class="ui simple dropdown item">
        Dropdown <i class="dropdown icon"></i>
        <div class="menu">
          <div class="item"><a href="#">Link Item</a></div>
          <div class="item">Link Item</div>
          ..
        </div>
      </a>
..

will break the page and result in:
Top: Chrome, Bottom: Firefox (Google is the a.item)

Most helpful comment

The problem was solved by changing my html code to

<div class="ui simple dropdown item">
    Dropdown <i class="dropdown icon"></i>
    <div class="menu">
        <a class="item" href="#">Link</a>
        ..
    </div>
</div>

otherwise it wouldn't be semantic ;)

All 5 comments

I'm experiencing the same on 2.1.6, why was this closed?

Edit: Found the issue. Anchor tags shouldn't be WITHIN anchor tags. So the outer anchor with .dropdown.item should be a div instead.

The problem was solved by changing my html code to

<div class="ui simple dropdown item">
    Dropdown <i class="dropdown icon"></i>
    <div class="menu">
        <a class="item" href="#">Link</a>
        ..
    </div>
</div>

otherwise it wouldn't be semantic ;)

Was this page helpful?
0 / 5 - 0 ratings