Skip to content
This repository has been archived by the owner. It is now read-only.

Dropdown needs two clicks to open #2294

Closed
joshvillbrandt opened this issue Jun 4, 2014 · 32 comments
Closed

Dropdown needs two clicks to open #2294

joshvillbrandt opened this issue Jun 4, 2014 · 32 comments

Comments

@joshvillbrandt
Copy link

@joshvillbrandt joshvillbrandt commented Jun 4, 2014

When upgrading from 0.10 to 0.11, drop-down menus started requiring two clicks in order to open (at least for nav-bar drop-down menus.) Removing data-toggle="dropdown" from the primary toggle element fixes the problem, but this is no longer the bootstrap-suggested syntax.

I suggest making a clear note of this in the documentation or make the dropdown directive compatible with the standard bootstrap syntax (like it was in 0.10.)

@jacqueslareau
Copy link

@jacqueslareau jacqueslareau commented Jun 4, 2014

+1

Took a while to find out the culprit!

@chrisirhc
Copy link
Member

@chrisirhc chrisirhc commented Jun 9, 2014

I believe you're including the bootstrap.min.js / bootstrap.js on top of ui-bootstrap.js . That's not compatible with the Angular UI Bootstrap JavaScript as the Bootstrap's code would interfere with UI Bootstrap's code. Could you create a Plunker that demonstrates this?

@alexander-konovalov
Copy link

@alexander-konovalov alexander-konovalov commented Jun 15, 2014

I created a Plunker http://plnkr.co/edit/osRsf6CTiQTFG7LpDt09?p=preview
Included: bootstrap.js and ui-bootstrap.js

At this page I do not use "dropdown" directive anywhere (In my opinion - as attribute)
"Button dropdown" is correct, but drop-down in header menu required two clicks because ui-bootstrap.js conflicts.

I think it's a bug, because I not set "dropdown" directive attribute explicitly.

@admitriyev
Copy link

@admitriyev admitriyev commented Jun 17, 2014

I observed the same issue when I upgraded from 0.10 to 0.11. When I change nothing else and revert back to 0.10, it works fine. I don't include bootsrap.js, but I use a bootswatch theme (Yeti) that loads bootstrap. Here is what I see in the final (produced by Rails) HTML:

<link href="/assets/yeti.css?body=1" media="all" rel="stylesheet">
<link href="/assets/yeti/loader.css?body=1" media="all" rel="stylesheet">
<link href="/assets/yeti/bootswatch.css?body=1" media="all" rel="stylesheet">

<script src="/assets/jquery.js?body=1"></script>
<script src="/assets/jquery_ujs.js?body=1"></script>
<script src="/assets/twitter/bootstrap/transition.js?body=1"></script>
<script src="/assets/twitter/bootstrap/alert.js?body=1"></script>
<script src="/assets/twitter/bootstrap/button.js?body=1"></script>
<script src="/assets/twitter/bootstrap/carousel.js?body=1"></script>
<script src="/assets/twitter/bootstrap/collapse.js?body=1"></script>
<script src="/assets/twitter/bootstrap/dropdown.js?body=1"></script>
<script src="/assets/twitter/bootstrap/modal.js?body=1"></script>
<script src="/assets/twitter/bootstrap/tooltip.js?body=1"></script>
<script src="/assets/twitter/bootstrap/popover.js?body=1"></script>
<script src="/assets/twitter/bootstrap/scrollspy.js?body=1"></script>
<script src="/assets/twitter/bootstrap/tab.js?body=1"></script>
<script src="/assets/twitter/bootstrap/affix.js?body=1"></script>
<script src="/assets/yeti/loader.js?body=1"></script>
<script src="/assets/yeti/bootswatch.js?body=1"></script>
<script src="/assets/angular.js?body=1"></script>
<script src="/assets/ui-bootstrap-tpls-0.11.0.min.js?body=1"></script>
<script src="/assets/ng-grid-2.0.11.min.js?body=1"></script>
@alexander-konovalov
Copy link

@alexander-konovalov alexander-konovalov commented Jun 21, 2014

Сool! Thank you!

2014-06-20 20:00 GMT+06:00 istibekesi notifications@github.com:

Ahhh, so change the order of the included js files, and place
ui-bootstrap-tpls first simply solves the issue... (?)

http://plnkr.co/edit/4DwcDJ2H9jyFS7Yo3oXd


Reply to this email directly or view it on GitHub
#2294 (comment)
.

@petermajor
Copy link

@petermajor petermajor commented Jun 21, 2014

I'm having the same issue

If I remove the UI-bootstrap script then the dropdown opens fine.

If I include the UI-bootstrap script then the dropdown doesn't open on the first click.

I've tried re-ordering the script blocks (mine are at the bottom of the page) and it doesn't make any difference if UI-bootstrap is before or after bootstrap.js....

@istibekesi
Copy link

@istibekesi istibekesi commented Jun 23, 2014

Sorry, I deleted my previous misleading post, because re-ordering makes no sense... In the plunk it seemed to be working, but the only reason why dropdown was working is that the whole bootstrap-ui js was broken.
Bootstrap ui needs to be placed after the angular.js...

However, change the version back to 0.10.0 was solved the dropdown issue in the navbar, but breaks other things, for example alert. I'm getting to be very confused:
http://plnkr.co/edit/49F6MRlGFxKo5RB2oEIN

@alexander-konovalov
Copy link

@alexander-konovalov alexander-konovalov commented Jun 23, 2014

You can temporarily use version 0.11.0 but without including ui.bootstrap.dropdown dependency.
Do not include "ui.bootstrap" and include only required modules

@sylvain-hamel
Copy link

@sylvain-hamel sylvain-hamel commented Jul 29, 2014

@chrisirhc regarding

you're including the bootstrap.min.js / bootstrap.js on top of ui-bootstrap.js . That's not compatible with the Angular UI Bootstrap JavaScript

Does it mean Angular UI Bootstrap includes all the features of bootstrap.js or does it mean we have to use the individual bootstrap.js parts that don't overlap with Angular UI Bootstrap?

@seyyedi
Copy link

@seyyedi seyyedi commented Aug 7, 2014

You have to remove the data-toggle attribute. dropdown-toggle directive already takes care of toggling. I had also some issues with <a href="#"> and resolved them by using <a href="javascript:void(0);"> (dropdown didn't always close)

@sylvain-hamel
Copy link

@sylvain-hamel sylvain-hamel commented Aug 13, 2014

@seyyedi Thanks a lot!

@herrminni
Copy link

@herrminni herrminni commented Aug 15, 2014

Thank you, I can confirm, that removing "data-toggle='dropdown'" works.
angul ui-bootstrap v0.11.0
Bootstrap v3.2.0

jamesrossiter added a commit to SolidStateGroup/patientview that referenced this issue Aug 28, 2014
@Snede
Copy link

@Snede Snede commented Sep 5, 2014

If you add data-disabled="true" on the element, you disable the angular-ui part and can use plain bootstrap.

We have a website where jquery(legacy) and Angular are mixed together.

@xumbino
Copy link

@xumbino xumbino commented Sep 5, 2014

@Snede answer works for me ;)

Thank you

@dmytro-shchurov
Copy link

@dmytro-shchurov dmytro-shchurov commented Sep 8, 2014

@seyyedi, @Snede, thank you so much )

@diazruy
Copy link

@diazruy diazruy commented Sep 9, 2014

FWIW, with @Snede's solution make sure the attribute is actually set to true (i.e. data-disabled="true") and not just present (i.e. data-disabled). The latter will not work.

@stewwan
Copy link

@stewwan stewwan commented Oct 7, 2014

same issue here, all worked fine when removed data-toggle. thx =D

@cebor
Copy link

@cebor cebor commented Oct 9, 2014

for now the workaround works, but 👍 for a fix !

@armengabrielyan
Copy link

@armengabrielyan armengabrielyan commented Oct 13, 2014

+1, but workaround works

@richardthombs
Copy link

@richardthombs richardthombs commented Oct 21, 2014

Glad I found this bug. Took a bit of Google-fu to get the keywords right :)

FWIW I removed my own reference to bootstrap.min.js - simply including angular-ui-bootstrap's javascript is sufficient to get "raw" Bootstrap dropdowns to work.

andresmanelli added a commit to MecatronicaUncu/Red-Social-Asociacion that referenced this issue Nov 3, 2014
@davisford
Copy link

@davisford davisford commented Nov 3, 2014

Can someone explain why it is now necessary to remove the dropdown-toggle attribute? I am defnitely not including any bootstrap javascript, but I'm trying to upgrade to angular 1.3.2.* and angular-ui 0.11.0 and it is a painful experience because so many things appear broken.

dropdown-toggle is still listed in the docs as necessary. Will removing this end up hosing it later down the line, when we pull another upgrade?

@chrisirhc
Copy link
Member

@chrisirhc chrisirhc commented Nov 3, 2014

This library currently doesn't support AngularJS 1.3. We're working towards that. Please report new issues that you find with your upgrade if they haven't already been reported.

@richardm
Copy link

@richardm richardm commented Nov 3, 2014

+1. Removing data-toggle="dropdown" fixes this issue

@davisford
Copy link

@davisford davisford commented Nov 4, 2014

@chrisirhc thanks for the feedback. So, pulling bower install angular-ui-bootstrap-bower@latest this fix indeed works, i.e. removing data-toggle="dropdown".

I believe the latest version released in the bower repo is 0.11.2

However, that version has several other things broken with respect to Angular 1.3.2 (e.g. tooltip broken).

So, I pulled from master and built my own today -- i.e. tracking 0.12-SNAPSHOT, and when I use that, this fix no longer works. Dropdowns don't seem to work anymore with or with out the data-toggle="dropdown" attribute.

Any idea?

Update Edit: actually, this markup fails:

<div dropdown class='btn-group'>
  <a type='button' role='button' class='btn btn-info dropdown-toggle'>Click</a>
  <ul class='dropdown-menu' role='menu'>
...

But change the directive attribute dropdown to a class, and it seems to work again?

<div class='btn-group dropdown'>
  ...
@brunosmartin
Copy link

@brunosmartin brunosmartin commented Dec 16, 2014

Upgrading to 0.12 solved it for me, even keeping data-toggle="dropdown"

@kmhigashioka
Copy link

@kmhigashioka kmhigashioka commented Feb 20, 2015

@Snede 's answer works for me.

@karianna karianna added this to the 0.12 milestone Feb 20, 2015
@karianna karianna closed this Feb 20, 2015
@sime
Copy link

@sime sime commented Feb 27, 2015

Trying to upgrade from 0.10.0 to 0.11 or 0.12 whilst using Angular 1.3.

Haven't been able to get 0.12 to work at all.

Since 0.11.1 the parent element of dropdown-toggle expects a dropdown class/attribute. This is documented, but 0.10.0 worked without it.

@sime
Copy link

@sime sime commented Mar 2, 2015

Ahh I didn't properly read the breaking changes in the CHANGELOG for dropdowns in 0.12.x. only dropdown and dropdown-toggle attributes are accepted.

openstack-gerrit pushed a commit to openstack/murano-dashboard that referenced this issue Sep 8, 2015
Before category dropdown did not auto closed itself after a category was
selected. This was most likely due to mixed use of jquery and
angular-ui. This commit sets correct data-toggle attribute and
data-disabled, that only enables plain bootstrap usage.
Also sets more "aria-labelledby" to point to toggle button, as most
examples suggest.

Reference: angular-ui/bootstrap#2294

Closes-Bug: #1478945
Change-Id: Ic1da66ac911677aeac7e7a7a6747b60d01b6e05e
@icfantv
Copy link
Member

@icfantv icfantv commented Nov 18, 2015

@theoziran, please do not only add +1 to issues. It does not add anything to the discussion and only clutters up the thread. Thanks.

markets added a commit to coopdevs/timeoverflow that referenced this issue Dec 31, 2015
rewritten added a commit to coopdevs/timeoverflow that referenced this issue Jan 19, 2016
* master: (29 commits)
  Annotate controller dependencies in modal call
  🔥 responders gem
  remove unused instance variable @gender_counts (related to bb9a2f0)
  fix path generation in grouped_index template
  move logic outside the view
  add Taggable tests, filter tags with 'ignore case', tokenSeparators only by comma
  posts (offers/inquiries) tests: check if tags are updating properly
  improve TagsController specs and fix a warning
  ✂️ a couple of unused views
  routes: little clean up
  Tags code clean up
  move tags related js outside the template
  ✂️ Tags Manager library
  New Tagging system using Select2 [WIP]
  continuation of 3a20539
  Angular annotations in array mode => ✂️ ngannotate-rails
  Drop a couple of deprecated partials
  [workaround] remove "data-toggle" => "dropdown" to avoid double click on dropdowns (more info: angular-ui/bootstrap#2294)
  use Rails.application instead of Timeoverflow::Application
  Update to latest rspec-rails (3.4)
  ...
@FlandersBurger
Copy link

@FlandersBurger FlandersBurger commented Dec 1, 2016

Although it solves the problem of not having to double-click, now the dropdown doesn't close when i select an element.

rschmertz pushed a commit to rschmertz/mcb-membership that referenced this issue Dec 19, 2016
@utkapodsousom
Copy link

@utkapodsousom utkapodsousom commented Jul 26, 2017

Confirmed! Adding 'data-disabled="true"' makes menu open on the first click, but in doesn't close

@vishwapratap
Copy link

@vishwapratap vishwapratap commented Jan 30, 2019

@chrisirhc thanks it works for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.