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 compute color contrast of <slot> elements #3847

Merged
merged 2 commits into from
Jan 6, 2023

Conversation

straker
Copy link
Contributor

@straker straker commented Jan 5, 2023

Closes: #3329

@straker straker requested a review from a team as a code owner January 5, 2023 17:05
@@ -906,6 +906,29 @@ describe('color-contrast', function () {
}
);

(shadowSupported ? it : xit)('handles <slot> elements', () => {
fixture.innerHTML =
Copy link
Contributor Author

@straker straker Jan 5, 2023

Choose a reason for hiding this comment

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

I couldn't use shadowCheckSetup because I needed the final node to be the paragraph, but trying to have the paragraph in the first parameter had the code add the shadow dom to it rather than the container element.

const shadowContainer = shadow.querySelector('#shadowContainer');
axe.testUtils.flatTreeSetup(fixture);

const target = fixture.querySelector('#target');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't use axe.utils.querySelector since the element is in the shadow dom in the virtual tree, so would need to select the shadow element and query selector from there.

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.

I'm not sure I fully understand the problem. Would like to get on a call to discuss.

lib/commons/dom/create-grid.js Outdated Show resolved Hide resolved
@WilcoFiers WilcoFiers merged commit 4c3a00c into develop Jan 6, 2023
@WilcoFiers WilcoFiers deleted the color-contrast-slot branch January 6, 2023 15:56
straker added a commit that referenced this pull request Jan 23, 2023
…nts (#3847)

* fix(color-contrast): correctly compute color contrast of <slot> elements

* Update lib/commons/dom/create-grid.js

Co-authored-by: Wilco Fiers <[email protected]>

Co-authored-by: Wilco Fiers <[email protected]>
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.

Color-contrast does not take into account <slot> elements and the light DOM
2 participants