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

Passing context changes base font-size on Internet Explorer #1585

Closed
yuderekyu opened this issue May 22, 2019 · 5 comments
Closed

Passing context changes base font-size on Internet Explorer #1585

yuderekyu opened this issue May 22, 2019 · 5 comments
Assignees
Labels
core Issues in the core code (lib/core) fix Bug fixes

Comments

@yuderekyu
Copy link

Description

If a context is passed to axe.run(), the accessibility check alters the root font size.

I inject axe into an Internet Explorer 11 driver instance (selenium grid 2.53.0). My component has a font-size set to 1.714rem and the base font size is 14px. This translates to a font size of 24px. But, accessibility returns an error stating that the font size is 17.9px, which then fails color contrast ratios for non large fonts. If I do not pass in a context and default to document, there are no errors.

Chrome and Firefox do not cause issues. I have updated axe-core to the latest release, but the issue still persists.

Expectation: axe.run to not alter base font-size based on context for supported browsers.

Actual: axe.runalters base font-size based on context on internet explorer


axe-core version: 3.0.3
@WilcoFiers
Copy link
Contributor

To the best of my knowledge, axe-core never sets any CSS properties. We'll have to investigate. Do you have a way for us to reproduce the issue? That would help narrow it down.

@WilcoFiers WilcoFiers added fix Bug fixes core Issues in the core code (lib/core) info needed More information or research is needed to continue labels May 24, 2019
@straker
Copy link
Contributor

straker commented Jun 5, 2019

Confirmed that when passing a context into axe.run, IE11 throws a color-contrast issue. https://codepen.io/straker/pen/Ezzxbw.

The issue seems to be that in IE11, the final computed font-size of the element is 23.93px or 17.9pt, which makes the element fall under the normal text size contrast ratio. I'll dig into why without a context it accepts it but with one it doesn't.

@straker straker removed the info needed More information or research is needed to continue label Jun 5, 2019
@straker
Copy link
Contributor

straker commented Jun 5, 2019

Found the bug. In IE11, document does not have the msMatchesSelector function in element-matches.js so color-contrast errors out when it tries to get all elements on the page starting at document. If you look at the results for a no-context run, the incomplete section shows the error (not helpful, but it's there).

It gets the document because in findUpVirtual the closest function doesn't exist so it scans up the tree using parentNode, which is document for the htmlElement

@yuderekyu
Copy link
Author

yuderekyu commented Jun 7, 2019

Awesome @straker! I see now I misread pt as px. Looks like IE rounds font-size to the hundredth spot https://phabricator.wikimedia.org/T102364

@WilcoFiers I'm sorry I didn't produce a reduce test case in time to speed up this process

@padmavemulapati
Copy link

Verified the fix availability, Done unit testing. Results are good , no failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues in the core code (lib/core) fix Bug fixes
Projects
None yet
Development

No branches or pull requests

4 participants