question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

target property with `:root > div > img` value

See original GitHub issue

Product: axe-core v4.3.2

Expectation: to return a target with which doing document.querySelector(target[0]); to return an html element.

Actual: it returns a target with which doing document.querySelector(target[0]); results with null.

website example: https://kenzdesigns.com.au/ code snippet:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Document Title</title>
    </head>
    <body>
    <div class="line1">Ethnicraft OLD SADDLE range&nbsp;</div>
    <div class="inner-div">
      <div class="col-xs-6 cat_pro_item">
        <a href="3 Seater">
          <div><img src="https://www.kenzdesigns.com.au/image/cache/catalog/Ethnicraft/20084-N701-3-seater-old-saddle-MAIN-145x200.jpg" class="img-responsive"></div>
        </a>
      </div>
      <div class="col-xs-6 cat_pro_item">
        <a href="1 Seater">
          <div><img src="https://www.kenzdesigns.com.au/image/cache/catalog/Ethnicraft/20082-N701-1-seater-old-saddle-main-145x200.jpg" class="img-responsive"></div>
        </a>
      </div>
      <div class="col-xs-6 cat_pro_item">
        <a href="Corner">
          <div><img src="https://www.kenzdesigns.com.au/image/cache/catalog/Ethnicraft/20080-N701-corner-sofa-old-saddle-145x200.jpg" class="img-responsive"></div>
        </a>
      </div>
      <div class="col-xs-6 cat_pro_item">
        <a href="Ottoman">
          <div><img src="https://www.kenzdesigns.com.au/image/cache/catalog/Ethnicraft/20081-N701-footstool-old-saddle-main-1-145x200.jpg" class="img-responsive"></div>
        </a>
      </div>
    </div>
    </body>
    </html>

when on this snippet I am doing axe.run(document, { runOnly: ['image-alt'] }); it returns

{
  violations: [
    {
      id: "image-alt",
      nodes: [
        {
          html: '<img src="https://www.kenzdesigns.com.au/image/cache/catalog/Ethnicraft/20084-N701-3-seater-old-saddle-MAIN-145x200.jpg" class="img-responsive">',
          target: [':root > div > img']
        }
      ]
    }
  ]
}

which then doing document.querySelector(':root > div > img') it returns null.

I am trying to understand if this is expected behaviour or a bug?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
strakercommented, Jan 17, 2022

We’ve completed the changes for this issue and a release is planned for the end of the month that will incorporate the fix.

1reaction
WilcoFierscommented, Aug 9, 2021

Wow! That’s an odd one. No idea how that might happen, but clearly :root > div > img is wrong. I’ll look into it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

<img>: The Image Embed element - HTML - MDN Web Docs
The above example shows usage of the <img> element: The src attribute is required, and contains the path to the image you want...
Read more >
Using the image tag in React - Dave Ceddia
When you img in a React component, the the src prop needs to be point ... the public folder as the “root” directory...
Read more >
How to Target the DOM in Vue - Telerik
In jQuery , you would select an element by targeting it with the $() function, and that would open up a wide variety...
Read more >
I want to change src property of image using :target. - Treehouse
I want to change src property of image using :target. I set img id to color. Link targets #color. CSS rule is #color:target...
Read more >
5. Working with the Shadow DOM - Modern JavaScript [Book]
A shadow host is a DOM node that contains a shadow root. ... This attribute can be added to a <content> element with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found