diff options
| author | Jacob <[email protected]> | 2014-07-21 22:48:08 -0700 |
|---|---|---|
| committer | Jacob <[email protected]> | 2014-07-21 22:48:08 -0700 |
| commit | f88e6ba2a3fea7348f9b0ff4118ccd18d8571b7a (patch) | |
| tree | bc97a0cadbe6baa255d9edb83e25c7b99a195c09 /js | |
| parent | 97cb2803d7698bdafc57820017ab8550b031d121 (diff) | |
| parent | 4775c9296ab95b49fc1e4b0f86d1db26176013ef (diff) | |
| download | bootstrap-f88e6ba2a3fea7348f9b0ff4118ccd18d8571b7a.tar.xz bootstrap-f88e6ba2a3fea7348f9b0ff4118ccd18d8571b7a.zip | |
Merge pull request #14208 from twbs/mckramer-dropdown-aria
Mckramer dropdown aria
Diffstat (limited to 'js')
| -rw-r--r-- | js/dropdown.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/js/dropdown.js b/js/dropdown.js index 88f118c2d..756fc21f5 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -42,7 +42,9 @@ if (e.isDefaultPrevented()) return - $this.trigger('focus') + $this + .trigger('focus') + .attr('aria-expanded', 'true') $parent .toggleClass('open') @@ -88,11 +90,17 @@ if (e && e.which === 3) return $(backdrop).remove() $(toggle).each(function () { - var $parent = getParent($(this)) + var $this = $(this) + var $parent = getParent($this) var relatedTarget = { relatedTarget: this } + if (!$parent.hasClass('open')) return + $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) + if (e.isDefaultPrevented()) return + + $this.attr('aria-expanded', 'false') $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) }) } |
