Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(color-contrast): correctly work with positioned elements without z-index #3209

Merged
merged 10 commits into from
Oct 18, 2021

Conversation

straker
Copy link
Contributor

@straker straker commented Oct 13, 2021

This one was a fun one to debug. The problem was that our code incorrectly ordered the stack of elements that were positioned (i.e. position: [absolute, relative, fixed]). Dug into the spec and found https://www.w3.org/Style/css2-updates/css2/zindex.html which mentioned that positioned elements and floated elements create their own stacking contexts if they don't have a z-index. So I modified our code to handle these "fake" stacking contexts and sort the elements correctly.

A note about the TODO, I have asked the Twitterverse if they can help give me some understanding, but for now I don't have an answer.

Closes issue: #2851

@straker straker requested a review from a team as a code owner October 13, 2021 23:31
Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple very minor points.

test/commons/dom/get-element-stack.js Outdated Show resolved Hide resolved
lib/commons/dom/get-rect-stack.js Outdated Show resolved Hide resolved
test/commons/dom/get-element-stack.js Outdated Show resolved Hide resolved
straker and others added 2 commits October 15, 2021 09:52
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
@straker straker merged commit 725a20c into develop Oct 18, 2021
@straker straker deleted the stacking-positioned branch October 18, 2021 14:15
straker added a commit that referenced this pull request Oct 18, 2021
…z-index (#3209)

* fix(color-contrast): correctly work with positioned elements without z-index

* correct link

* add back test

* fix

* revert playground

* typo

* typo

* Update lib/commons/dom/get-rect-stack.js

Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>

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

Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>

* fix

Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants