You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tested the issue with the latest version of the product
Issue Description
The accessibleText utility doesn't correctly handle cases where the target element is aria-labelledby an aria-hidden element that contains a <style> element. We noticed this in practice against some of the icon buttons at the top-right of https://github.com, which use a pattern along these lines:
...and the accessible text comes back like ".stuff {} Tooltip content" instead of the expected "Tooltip content".
Expectation
The 2 new test cases below should pass
Actual
They fail
How to Reproduce
// /test/commons/text/accessible-text.jsit('should not use <style> contents as a label, even if explicitly referenced with labelledby',()=>{fixture.innerHTML=html`<divid="t1" aria-labelledby="style-id"></div><styleid="style-id">.shouldnt-be-part-of-accessible-text {}</style> `axe.testUtils.flatTreeSetup(fixture);consttarget=axe.utils.querySelectorAll(axe._tree,'#t1')[0];assert.equal(axe.commons.text.accessibleTextVirtual(target),'');});it('should not use <style> contents as a label, even if labelledby explicitly references a hidden container',()=>{fixture.innerHTML=html`<divid="t1" aria-labelledby="hidden-container"></div><divid="hidden-container" aria-hidden="true"><style>.shouldnt-be-part-of-accessible-text {}</style> Expected label</div> `axe.testUtils.flatTreeSetup(fixture);consttarget=axe.utils.querySelectorAll(axe._tree,'#t1')[0];assert.equal(axe.commons.text.accessibleTextVirtual(target),'Expected label');});
Additional context
I already double checked in Chrome/Firefox/Safari that the browsers don't include the <style> contents in their calculations here.
The text was updated successfully, but these errors were encountered:
dbjorge
added
ungroomed
Ticket needs a maintainer to prioritize and label
fix
Bug fixes
commons
Issues in the common code (lib/commons)
and removed
ungroomed
Ticket needs a maintainer to prioritize and label
labels
Feb 8, 2025
Product
axe-core
Product Version
4.10.2
Latest Version
Issue Description
The
accessibleText
utility doesn't correctly handle cases where the target element isaria-labelledby
anaria-hidden
element that contains a<style>
element. We noticed this in practice against some of the icon buttons at the top-right of https://github.com, which use a pattern along these lines:...and the accessible text comes back like
".stuff {} Tooltip content"
instead of the expected"Tooltip content"
.Expectation
The 2 new test cases below should pass
Actual
They fail
How to Reproduce
Additional context
I already double checked in Chrome/Firefox/Safari that the browsers don't include the
<style>
contents in their calculations here.The text was updated successfully, but these errors were encountered: