Skip to content

Improvements for the color contrast check against default theme colors. #6484

Closed

Description

@afercia

Premise: I haven't looked at the code.

When setting the text color to a value that produces an insufficient contrast ratio with the default background color, there's no warning:

Custom text color vs. default background (white in this case):

screen shot 2018-04-28 at 16 09 04

Vice-versa, a custom background that produces an insufficient contrast ratio with the default text color, does show the warning:

screen shot 2018-04-28 at 16 09 45

It would be great to have the check work also with the default background color.

Also wondering what happens when in the future themes will be able to provide their own background / text colors, see for example #6404:

One long term vision for the editor, is to allow you to load the theme stylesheet into the editor canvas itself ...

Activity

  1. added
    [Focus] Accessibility (a11y)
    on Apr 28, 2018
  2. jorgefilipecosta commented on Apr 30, 2018

    @jorgefilipecosta
    Member

    Hi @afercia, what happens is that by default the background of the paragraph is rgba( 0, 0, 0, 0) (totally transparent), we can not know what is, in fact, the background color. The theme may even set an image as background and we can not compute the right color. A block can also set a backrgound for nested paragraphs e.g: cover image. If the theme sets a background color e.g: white and correctly loads the styles, we will be able to shown warnings. But if no changes happen we can not make sure if the contrast is right or not.

    For the text color, we show warning because at the start it is not transparent, by default we set a color.

  3. afercia commented on Apr 30, 2018

    @afercia
    ContributorAuthor

    Hi @jorgefilipecosta thanks, I understand a bit better now. Then if there are no reliable ways to detect the background color when blocks are transparent and the theme doesn't set a background color, please do feel free to close this issue,

  4. jorgefilipecosta commented on Apr 30, 2018

    @jorgefilipecosta
    Member

    Unfortunately, it looks like in fact, right now we don't have a reliable way to detect what the background color (or colors) will end up being. So I'm closing this issue, for now, thank you for referring this issue.

  5. afercia commented on May 1, 2018

    @afercia
    ContributorAuthor

    For some background, see #5658 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Focus] Accessibility (a11y)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions