Skip to content

Commit f479977

Browse files
authored
Merge pull request #2247 from dequelabs/release-3.5.4
Release 3.5.4
2 parents ffa6669 + 150c163 commit f479977

7 files changed

Lines changed: 55 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [3.5.4](https://github.com/dequelabs/axe-core/compare/v3.5.3...v3.5.4) (2020-05-22)
6+
7+
### Bug Fixes
8+
9+
- **get-element-stack:** properly calculate position of children of floated elements ([28a8c58](https://github.com/dequelabs/axe-core/commit/28a8c58b409461600da07eac164e5b0ca4744502))
10+
511
### [3.5.3](https://github.com/dequelabs/axe-core/compare/v3.5.2...v3.5.3) (2020-03-31)
612

713
### Bug Fixes

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "axe-core",
3-
"version": "3.5.3",
3+
"version": "3.5.4",
44
"contributors": [
55
{
66
"name": "David Sturley",

lib/commons/dom/get-element-stack.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,32 @@ function isStackingContext(vNode, parentVNode) {
141141
return false;
142142
}
143143

144+
/**
145+
* Check if a node or one of it's parents is floated.
146+
* Floating position should be inherited from the parent tree
147+
* @see https://github.com/dequelabs/axe-core/issues/2222
148+
*/
149+
function isFloated(vNode) {
150+
if (!vNode) {
151+
return false;
152+
}
153+
154+
if (vNode._isFloated !== undefined) {
155+
return vNode._isFloated;
156+
}
157+
158+
const floatStyle = vNode.getComputedStylePropertyValue('float');
159+
160+
if (floatStyle !== 'none') {
161+
vNode._isFloated = true;
162+
return true;
163+
}
164+
165+
const floated = isFloated(vNode.parent);
166+
vNode._isFloated = floated;
167+
return floated;
168+
}
169+
144170
/**
145171
* Return the index order of how to position this element. return nodes in non-positioned, floating, positioned order
146172
* References:
@@ -160,7 +186,7 @@ function getPositionOrder(vNode) {
160186
}
161187

162188
// 4. the non-positioned floats.
163-
if (vNode.getComputedStylePropertyValue('float') !== 'none') {
189+
if (isFloated(vNode)) {
164190
return 1;
165191
}
166192

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "axe-core",
33
"description": "Accessibility engine for automated Web UI testing",
4-
"version": "3.5.3",
4+
"version": "3.5.4",
55
"license": "MPL-2.0",
66
"engines": {
77
"node": ">=4"

sri-history.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,9 @@
182182
"3.5.3": {
183183
"axe.js": "sha256-lO/Zp+gRgYruJbjyvHOfqWqqroJ2ogTLJ64DwunyUz4=",
184184
"axe.min.js": "sha256-Oh5/ClgfAAKQWyCvlU3F+Ud6QDsS0myLJr866QFt67w="
185+
},
186+
"3.5.4": {
187+
"axe.js": "sha256-4f1ZZbAr3xgoAputB3oZK5ASoazrNIw6SU2M1Nnb4bg=",
188+
"axe.min.js": "sha256-XDhCakYtcQtOpujvhE876/a4fUyZjiKtNn8xniP03Ek="
185189
}
186190
}

test/commons/dom/get-element-stack.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ describe('dom.getElementStack', function() {
8585
assert.deepEqual(stack, ['4', '1', '2', 'target', 'fixture']);
8686
});
8787

88+
it('should handle floating parent elements', function() {
89+
fixture.innerHTML =
90+
'<div id="1" style="float: left; background: #000000; color: #fff;">' +
91+
'<div id="2"><span id="target">whole picture</span></div>' +
92+
'</div>' +
93+
'<div id="3">' +
94+
'<div id="4" style="background: #f2f2f2;">English</div>' +
95+
'</div>';
96+
97+
axe.testUtils.flatTreeSetup(fixture);
98+
var target = fixture.querySelector('#target');
99+
var stack = mapToIDs(getElementStack(target));
100+
assert.deepEqual(stack, ['target', '2', '1', '4', '3', 'fixture']);
101+
});
102+
88103
it('should handle z-index positioned elements in the same stacking context', function() {
89104
// see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_context_example_1
90105
fixture.innerHTML =

0 commit comments

Comments
 (0)