Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
b395f352
Commit
b395f352
authored
10 years ago
by
vsn4ik
Committed by
Heinrich Fenkart
10 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Dropdowns: Skip `.disabled` instead of `.divider` on keydown event
Fixes
#15147
. Closes #15520 by merging it.
parent
5debbec5
4 merge requests
!28721
Hot test
,
!16605
Test pull please ignore
,
!22103
test
,
!25326
Adjust examples
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/dropdown.js
+1
-1
js/dropdown.js
js/tests/unit/dropdown.js
+21
-0
js/tests/unit/dropdown.js
with
22 additions
and
1 deletion
+22
-1
js/dropdown.js
+
1
-
1
View file @
b395f352
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
return
$this
.
trigger
(
'
click
'
)
return
$this
.
trigger
(
'
click
'
)
}
}
var
desc
=
'
li:not(.di
vider
):visible a
'
var
desc
=
'
li:not(.di
sabled
):visible a
'
var
$items
=
$parent
.
find
(
'
[role="menu"]
'
+
desc
+
'
, [role="listbox"]
'
+
desc
)
var
$items
=
$parent
.
find
(
'
[role="menu"]
'
+
desc
+
'
, [role="listbox"]
'
+
desc
)
if
(
!
$items
.
length
)
return
if
(
!
$items
.
length
)
return
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/dropdown.js
+
21
-
0
View file @
b395f352
...
@@ -314,4 +314,25 @@ $(function () {
...
@@ -314,4 +314,25 @@ $(function () {
$dropdown
.
click
()
$dropdown
.
click
()
})
})
QUnit
.
test
(
'
should skip disabled element when using keyboard navigation
'
,
function
(
assert
)
{
var
dropdownHTML
=
'
<ul class="tabs">
'
+
'
<li class="dropdown">
'
+
'
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
'
+
'
<ul class="dropdown-menu" role="menu">
'
+
'
<li class="disabled"><a href="#">Disabled link</a></li>
'
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
var
$dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
bootstrapDropdown
()
.
click
()
$dropdown
.
trigger
(
$
.
Event
(
'
keydown
'
,
{
which
:
40
}))
$dropdown
.
trigger
(
$
.
Event
(
'
keydown
'
,
{
which
:
40
}))
assert
.
ok
(
!
$
(
document
.
activeElement
).
parent
().
is
(
'
.disabled
'
),
'
.disabled is not focused
'
)
})
})
})
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets