Skip to content

Improve accessibility of OpenAPI specification documents #3946

Closed

Description

@ralfhandl

Recommendation by @stringtheory

Findings

  • Background and foreground colors do not have a sufficient contrast ratio.
    • Syntax highlighting of JSON and YAML: string orange, comment grey, and other colors are too bright
      • Fall back to current ReSpec default colors and nudge the problematic ones a little
    • The bright green headlines are problematic
  • Links rely on color to be distinguishable.
    • RFC references - make them bold and underlined?

Additional findings (not strictly accessibility)

  • Inconsistent headline formatting
    • h1 and h2 are normal and green
    • h3 is bold and black
    • h4 is italicized and black
    • h5 is small-caps and black
  • empty line at start of each code block

Accessible preview: https://ralfhandl.github.io/OpenAPI-Specification/oas/latest-a11y.html
image

Currently published: https://spec.openapis.org/oas/latest.html
image

Activity

  1. added this to the v3.0.4 milestone on Jul 8, 2024
  2. stringtheory commented on Jul 10, 2024

    @stringtheory

    Just wanted to throw in some general comments.

    @ralfhandl Amazing work using lighthouse and going through.

    Agree that the bright green headlines are problematic. Your style guide is also problematic in the way it specs out colors. It is in CMYK - so the colors you are picking from don't even really match. I played with correct conversions here. https://codepen.io/stringtheory/pen/VwJYjWP
    I am glad to provide a couple of alternative colors that meet the current spec and also future-proof you to the new spec.

    I went up the chain a bit with the Accessibility Spec people - since there is less of a definitive answer on the color formatting for syntax highlighting // and am awaiting to hear back.

    For distinguishable links - a very common way to handle them is with an underline. You will have bold for other things in the spec so you don't want to add confusion.

    I am swamped until late this week - but glad to go into more detail and help further then - if you don't mind waiting.

  3. ralfhandl commented on Jul 10, 2024

    @ralfhandl
    ContributorAuthor

    Your style guide is also problematic in the way it specs out colors. It is in CMYK - so the colors you are picking from don't even really match. I played with correct conversions here. https://codepen.io/stringtheory/pen/VwJYjWP

    Thanks, I wondered how the Pantone colors 7737 C, 574 C, and 375 C mentioned in the OpenAPI Style Guide are correctly translated to hex colors.

    Trying four different "Pantone to hex" converters on the web I ended up with three different sets of hex colors 😁. The two that agreed are slightly different from your conversion:

    Pantone Hex
    7737 C #6BA539 6BA539
    574 C #4E5B31 4E5B31
    375 C #97D700 97D700

    So which ones are correct? I don't want to create a user for accessing https://www.pantone.com/color-finder ☹️

  4. stringtheory commented on Aug 1, 2024

    @stringtheory

    In the end, I pulled colors out of the logo graphics file (that did not match the Pantone at all). I have official Pantone conversions - but I actually could not get them to line up with the colors in your graphics files.

    https://codepen.io/stringtheory/pen/abgJYmb

    I picked 2 options for text options that pass the AA success criteria and work with your color palette.

    Different color options read better - but updating your color palette is a bigger discussion / so for now just using a re-colored version of a palette from the logo on your site.

    OKLCH: oklch(56% 20% 126)
    Hex: #677C46
    Contrast Ratio 4.66:1

    OKLCH: oklch(45% 36% 129)
    Hex: #578000
    Contrast Ratio 4.67:1

  5. ralfhandl commented on Aug 1, 2024

    @ralfhandl
    ContributorAuthor

    Tried both colors and the current one and put them in the next comments.

    You can upvote (👍🏻) which one(s) you like most.

  6. ralfhandl commented on Aug 2, 2024

    @ralfhandl
    ContributorAuthor
  7. ralfhandl commented on Aug 2, 2024

    @ralfhandl
    ContributorAuthor
  8. ralfhandl commented on Aug 2, 2024

    @ralfhandl
    ContributorAuthor
  9. lornajane commented on Aug 8, 2024

    @lornajane
    Contributor

    The right hand option is chosen.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions