Skip to content

<slot> with display: inline-block causes color-contrast to be incomplete #4468

Open
@frehner

Description

@frehner

Product

axe-core via @axe-core/playwright

Product Version

No response

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

Expectation

Adding display: inline-block styling to a <slot> element should not cause the color-contrast rule to be incomplete.

Actual

The color-contrast rule is incomplete with the warning:

Element's background color could not be determined because it is overlapped by another element

How to Reproduce

If you update axe-test-fixtures/fixtures/shadow-dom.html to include this new code:

<span id="shadow-root-3">Slotted</span>

<script>
      const shadowRoot3 = document
        .querySelector('#shadow-root-3')
        .attachShadow({ mode: 'open' });
      shadowRoot3.innerHTML = `
        <button id="shadow-button-3"><slot style="display:inline-block;"/></button>
      `;
</script>

and add this line to your axe-playwright.spec.ts "with include shadow DOM" test

        .include([['#shadow-root-3', '#shadow-button-3']])

And add an assertion for that new element. The test will fail, and you'll find the color-contrast rule will now be in results.incomplete.

Additional context

I'm fairly new to this repo, so I suspect that the issue may be in axe-core but I'm not sure. Let me know if that's the case and that I need to move it there. 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions