Closed Bug 1505848 Opened 2 years ago Closed 2 years ago

Improve how color contrast ratio indicator works in accessibility highlighter.

Categories

(DevTools :: Accessibility Tools, enhancement)

enhancement
Not set
normal

Tracking

(firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: yzen, Assigned: yzen)

References

Details

(Keywords: dev-doc-needed)

Attachments

(3 files)

Accessibility highlighter currently can only handle well simple cases where color and background are set on the element itself or in its ancestry. It does not deal well with cases like:

* Handling text nodes directly (which is not possible via simple pointer event listening)
* Handling text that is laid out differently from being contained by its ancestry
* Gradients
* Background images

The approach that we would like to investigate would use canvas API to determine contrast ratios of pixel values between 2 different images: one with text as is and another with text where color and text-shadows are unset to be displayed as transparent.

The only unsolved use case that will remain are the text nodes that have transparent color but have the background set to background-clip: text.
See Also: → 1506926
See Also: → 1507027
Pushed by yura.zenevich@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/d5c99e37f121
change the way accessible object is determined when using accessible highlighter. r=pbro
https://hg.mozilla.org/integration/autoland/rev/d051864f170d
expose some of the css color utils and ensure that RGBA alpha value is not cut off at 1 decimal. r=pbro
https://hg.mozilla.org/integration/autoland/rev/403db98e8ac8
switch from CSS based approach to calculating contrast to canvas one, that also handles gradients and images. r=jdescottes,pbro
Comment on attachment 9023743 [details]
Bug 1505848 - change the way accessible object is determined when using accessible highlighter. r?pbro

[Beta/Release Uplift Approval Request]

Feature/Bug causing the regression: Bug 1505848

User impact if declined: Accessibility panel (DevTools) Users will not have an accurate color contrast indicator. It will aslo be confusing in many cases because it currently shows contrast score for elements it never should.

Is this code covered by automated tests?: No

Has the fix been verified in Nightly?: Yes

Needs manual test from QE?: No

If yes, steps to reproduce: 

List of other uplifts needed: None

Risk to taking this patch: Low

Why is the change risky/not risky? (and alternatives if risky): Only affects users that use highlighter in the accessibility panel (developer tools) - about 20K DAU max.

String changes made/needed: None
Attachment #9023743 - Flags: approval-mozilla-beta?
Comment on attachment 9023744 [details]
Bug 1505848 - expose some of the css color utils and ensure that RGBA alpha value is not cut off at 1 decimal. r?pbro

[Beta/Release Uplift Approval Request]

Feature/Bug causing the regression: Bug 1505848

User impact if declined: Accessibility panel (DevTools) Users will not have an accurate color contrast indicator. It will aslo be confusing in many cases because it currently shows contrast score for elements it never should.

Is this code covered by automated tests?: No

Has the fix been verified in Nightly?: Yes

Needs manual test from QE?: No

If yes, steps to reproduce: 

List of other uplifts needed: None

Risk to taking this patch: Low

Why is the change risky/not risky? (and alternatives if risky): Only affects highlighter users of the accessibility panel (Devtools) about 20K DAU max

String changes made/needed: None
Attachment #9023744 - Flags: approval-mozilla-beta?
Comment on attachment 9023746 [details]
Bug 1505848 - switch from CSS based approach to calculating contrast to canvas one, that also handles gradients and images. r?pbro

[Beta/Release Uplift Approval Request]

Feature/Bug causing the regression: Bug 1505848

User impact if declined: Accessibility panel (DevTools) Users will not have an accurate color contrast indicator. It will aslo be confusing in many cases because it currently shows contrast score for elements it never should.

Is this code covered by automated tests?: No

Has the fix been verified in Nightly?: Yes

Needs manual test from QE?: No

If yes, steps to reproduce: 

List of other uplifts needed: None

Risk to taking this patch: Low

Why is the change risky/not risky? (and alternatives if risky): Only affects highlighter users of the accessibility panel (Devtools) about 20K DAU max

String changes made/needed: accessibility.contrast.ratio.error, accessibility.contrast.ratio.label in devtools/shared/locales/en-US/accessibility.properties
Attachment #9023746 - Flags: approval-mozilla-beta?
Comment on attachment 9023743 [details]
Bug 1505848 - change the way accessible object is determined when using accessible highlighter. r?pbro

Sorry, not going to add new strings to beta 2 weeks before RC.
Attachment #9023743 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
Attachment #9023744 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
Attachment #9023746 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
Keywords: dev-doc-needed
Depends on: 1512980
You need to log in before you can comment on or make changes to this bug.