Skip to content

Commit 3f070bd

Browse files
committed
Core: Fixed :focusable and :tabbable selectors for to work with :hidden and :visibile selectors in jQuery 1.3.2+. Still need to handle areas properly. Partial fix for #4488 - :focusable and :tabbable are broken with jQuery 1.3.2.
1 parent 4c55071 commit 3f070bd

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

tests/unit/core/core.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ <h2 id="qunit-userAgent"></h2>
8282
<div>
8383
<div id="displayNoneAncestor" style="display: none;">
8484
<input id="displayNoneAncestor-input" />
85-
<span tabindex="1" id="displayNoneAncestor-span"></span>
85+
<span tabindex="1" id="displayNoneAncestor-span">.</span>
8686
</div>
8787

8888
<div id="visibilityHiddenAncestor" style="visibility: hidden;">
8989
<input id="visibilityHiddenAncestor-input" />
90-
<span tabindex="1" id="visibilityHiddenAncestor-span"></span>
90+
<span tabindex="1" id="visibilityHiddenAncestor-span">.</span>
9191
</div>
9292

9393
<input id="displayNone-input" style="display: none;" />
9494
<input id="visibilityHidden-input" style="visibility: hidden;" />
9595

96-
<span tabindex="1" id="displayNone-span" style="display: none;"></span>
97-
<span tabindex="1" id="visibilityHidden-span" style="visibility: hidden;"></span>
96+
<span tabindex="1" id="displayNone-span" style="display: none;">.</span>
97+
<span tabindex="1" id="visibilityHidden-span" style="visibility: hidden;">.</span>
9898
</div>
9999

100100
<div>
@@ -103,28 +103,28 @@ <h2 id="qunit-userAgent"></h2>
103103
<input id="inputTabindex-1" tabindex="-1" />
104104
<input id="inputTabindex-50" tabindex="-50" />
105105

106-
<span id="spanTabindex0" tabindex="0"></span>
107-
<span id="spanTabindex10" tabindex="10"></span>
108-
<span id="spanTabindex-1" tabindex="-1"></span>
109-
<span id="spanTabindex-50" tabindex="-50"></span>
106+
<span id="spanTabindex0" tabindex="0">.</span>
107+
<span id="spanTabindex10" tabindex="10">.</span>
108+
<span id="spanTabindex-1" tabindex="-1">.</span>
109+
<span id="spanTabindex-50" tabindex="-50">.</span>
110110
</div>
111111

112112
<div>
113113
<input id="inputTabindexfoo" tabindex="foo" />
114114
<input id="inputTabindex3foo" tabindex="3foo" />
115115

116-
<span id="spanTabindexfoo" tabindex="foo"></span>
117-
<span id="spanTabindex3foo" tabindex="3foo"></span>
116+
<span id="spanTabindexfoo" tabindex="foo">.</span>
117+
<span id="spanTabindex3foo" tabindex="3foo">.</span>
118118
</div>
119119

120120
<div id="zIndex100" style="z-index: 100; position: absolute">
121-
<div id="zIndexAutoWithParent"></div>
121+
<div id="zIndexAutoWithParent">.</div>
122122
</div>
123123
<div id="zIndex100ViaCSS" class="zindex">
124-
<div id="zIndexAutoWithParentViaCSS"></div>
124+
<div id="zIndexAutoWithParentViaCSS">.</div>
125125
</div>
126126
<div id="zIndex100ViaCSSPositioned" class="zindex absolute">
127-
<div id="zIndexAutoWithParentViaCSSPositioned"></div>
127+
<div id="zIndexAutoWithParentViaCSSPositioned">.</div>
128128
</div>
129129
<div id="zIndexAutoNoParent"></div>
130130
</div>

tests/unit/core/selector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ test("focusable - hidden styles", function() {
132132
isNotFocusable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
133133
});
134134

135-
test("focusable - natively focusable with various tabindex", function() {
135+
test("focusable - natively focusable with various tabindex", function() {
136136
expect(4);
137137

138138
isFocusable('#inputTabindex0', 'input, tabindex 0');
@@ -141,7 +141,7 @@ test("focusable - natively focusable with various tabindex", function() {
141141
isFocusable('#inputTabindex-50', 'input, tabindex -50');
142142
});
143143

144-
test("focusable - not natively focusable with various tabindex", function() {
144+
test("focusable - not natively focusable with various tabindex", function() {
145145
expect(4);
146146

147147
isFocusable('#spanTabindex0', 'span, tabindex 0');

ui/jquery.ui.core.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ $.extend($.expr[':'], {
203203
: !isNaN(tabIndex))
204204
// the element and all of its ancestors must be visible
205205
// the browser may report that the area is hidden
206-
&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
206+
&& !$(element).parents().andSelf().filter(function() {
207+
return $.curCSS( this, "visibility" ) === "hidden" ||
208+
$.expr.filters.hidden( this );
209+
}).length;
207210
},
208211

209212
tabbable: function(element) {

0 commit comments

Comments
 (0)