Skip to content

Improvements to Accessibility #3422

@dinonuggies1

Description

@dinonuggies1

Hello, graphiql maintainers!

GitHub's API team provides an integrated client within GitHub's public web documentation for GraphQL. We're big fans of the tool, and use it as a means for integrators to become more familiar with our GraphQL schema. We've recently upgraded to the latest version of the graphiql package (3.0.5 as of September 18, 2023), and thereby many built in features of the client. This client is one of the most utilized aspects of the GraphQL doc set, so it's highly visible for visitors with GraphQL in mind.

Recently, we've placed a stronger focus on making our web experience more accessible as we strive to become the home for all developers. With that in mind, we believe there are a few improvements that would greatly enhance the experience of developers/users with varying disabilities. 🎉

Here are a few accessibility concerns identified by an internal audit here at GitHub:

  1. The elements of the Graphiql explorer pane are not focusable:

Image

In other words, when a user tabs through the explorer pane, each schema component/form element should be focusable

  1. The focus order is not logical:

Image

In this instance, the user tabs to the "History", hits enter, and instead of the next tab sequence stepping into the History view, the user is directed to the next button (The Explorer button).

  1. There isn't appropriate labels for the form elements of the GraphiQL Explorer pane (i.e: fields, queries, or mutation):

Image

Providing the right aria-label helps people who utilize screen readers.

  1. Form elements don't include the role attribute for the GraphiQL Explorer:

Image

** screen reader concern

  1. Missing associated label 'Add new' along with the query dropdown.

Image

** screen reader concern

  1. The luminosity ratio of the ' " _" ' should be greater than or equal to 4.5:1:

Image

** Update - September 27th, 2023

  1. The luminosity ratio for the text within the query editor and results pane doesn't meet the contrast ratio of 4.5:1 for the default light mode or dark mode (Although, Dark mode is closer 👍🏽). I've taken a dive into each element of the query editor in hopes that it'll help shed light on the selectors that require adjustments. 🙏🏽

With Default (Light) Theme

Screenshot 2023-09-25 at 3 20 20 PM

class foreground color - properties background color - query editor section contrast ratio Meets WCAG AA? background color - results section contrast ratio Meets WCAG AA?
.cm-s-graphiql .cm-keyword { color: hsl(var(--color-primary)) } #d60590 #ffffff 4.9:1 #f3f4f5 4.45:1
.cm-s-graphiql .cm-def { color: hsl(var(--color-tertiary)) } #009fb8 #ffffff 3.15:1 #f3f4f5 2.86:1
.cm-s-graphiql .cm-punctuation { color: hsla(var(--color-neutral),var(--alpha-tertiary)) } #3b4b68 alpha = .5 #ffffff 8.77:1 #f3f4f5 7.97:1
.cm-s-graphiql .cm-variable { color: hsl(var(--color-secondary)) } #6c69ce #ffffff 4.61:1 #f3f4f5 4.19:1
.cm-s-graphiql .cm-atom { color: hsl(var(--color-tertiary)) } #009fb8 #ffffff 3.15:1 #f3f4f5 2.86:1
.cm-s-graphiql .cm-number { color: hsl(var(--color-success)) } #2bab7c #ffffff 2.9:1 #f3f4f5 2.64:1
.cm-s-graphiql .cm-string { color: hsl(var(--color-warning)) } #d17d00 #ffffff 3.16:1 #f3f4f5 2.86:1
.cm-s-graphiql .cm-builtin { color: hsl(var(--color-success)) } #2bab7c #ffffff 2.9:1 #f3f4f5 2.64:1
.cm-s-graphiql .cm-string-2 { color: hsl(var(--color-secondary)) } #6c69ce #ffffff 4.61:1 #f3f4f5 4.19:1
.cm-s-graphiql .cm-attribute,.cm-s-graphiql .cm-meta { color: hsl(var(--color-tertiary)) } #009fb8 #ffffff 3.15:1 #f3f4f5 2.86:1
.cm-s-graphiql .cm-property { color: hsl(var(--color-info)) } #007deb #ffffff 4.09:1 #f3f4f5 3.71:1
.cm-s-graphiql .cm-qualifier { color: hsl(var(--color-secondary)) } #6c69ce #ffffff 4.61:1 #f3f4f5 4.19:1
.cm-s-graphiql .cm-comment { color: hsla(var(--color-neutral),var(--alpha-secondary)) } #3b4b68 alpha = .76 #ffffff 8.77:1 #f3f4f5 7.97:1
.cm-s-graphiql .cm-ws { color: hsla(var(--color-neutral),var(--alpha-tertiary)) } #3b4b68 alpha = .5 #ffffff 8.77:1 #f3f4f5 7.97:1
.cm-s-graphiql .cm-invalidchar { color: hsl(var(--color-error)) } #f85b30 #ffffff 3.21:1 #f3f4f5 2.92:1

With Dark Mode Theme

Screenshot 2023-09-25 at 3 22 17 PM

class foreground color - properties background color - query editor section contrast ratio Meets WCAG AA? background color - results section contrast ratio Meets WCAG AA?
.cm-s-graphiql .cm-keyword { color: hsl(var(--color-primary)) } #ff5794 #212a3b 4.82:1 #2D3647 4.07:1
.cm-s-graphiql .cm-def { color: hsl(var(--color-tertiary)) } #00c2e0 #212a3b 6.71:1 #2D3647 5.65:1
.cm-s-graphiql .cm-punctuation { color: hsla(var(--color-neutral)) } #b7c2d7 #212a3b 8.02:1 #2D3647 6.76:1
.cm-s-graphiql .cm-variable { color: hsl(var(--color-secondary)) } #908aff #212a3b 4.97:1 #2D3647 4.19:1
.cm-s-graphiql .cm-atom { color: hsl(var(--color-tertiary)) } #00c2e0 #212a3b 6.71:1 #2D3647 5.65:1
.cm-s-graphiql .cm-number { color: hsl(var(--color-success)) } #00d688 #212a3b 7.52:1 #2D3647 6.34:1
.cm-s-graphiql .cm-string { color: hsl(var(--color-warning)) } #ffcc99 #212a3b 9.83:1 #2D3647 8.29:1
.cm-s-graphiql .cm-builtin { color: hsl(var(--color-success)) } #00d688 #212a3b 7.52:1 #2D3647 6.34:1
.cm-s-graphiql .cm-string-2 { color: hsl(var(--color-secondary)) } #908aff #212a3b 4.97:1 #2D3647 4.19:1
.cm-s-graphiql .cm-attribute,.cm-s-graphiql .cm-meta { color: hsl(var(--color-tertiary)) } #00c2e0 #212a3b 6.71:1 #2D3647 5.65:1
.cm-s-graphiql .cm-property { color: hsl(var(--color-info)) } #70bcff #212a3b 7.07:1 #2D3647 5.96:1
.cm-s-graphiql .cm-qualifier { color: hsl(var(--color-secondary)) } #908aff #212a3b 4.97:1 #2D3647 4.19:1
.cm-s-graphiql .cm-comment { color: hsla(var(--color-neutral)) } #b7c2d7 #212a3b 8.02:1 #2D3647 6.76:1
.cm-s-graphiql .cm-ws { color: hsla(var(--color-neutral)) } #b7c2d7 #212a3b 8.02:1 #2D3647 6.76:1
.cm-s-graphiql .cm-invalidchar { color: hsl(var(--color-error)) } #ff5729 #212a3b 4.55:1 #2D3647 3.84:1

As you can see, most of our accessibility findings stem from the GraphQL Explorer feature, or more specifically, the @graphiql/explorer-plugin package. It could be that these concerns have been addressed in more recent versions of the explorer, however, we encountered some issues upgrading to the latest graphiql package with the explorer package included. We did have success upgrading to version 0.1.4 of the explorer plugin along with 2.0.7 of the graphiql package, but noticed that the same issues remained. If it's confirmed that the above has been addressed in later versions of the explorer plugin, we'd be happy to invest more time into the upgrade, but for the moment, we've decided to omit the explorer feature from the client given the accessibility concerns above.

Lastly, thanks for all the hard work you've put into making this a great tool! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions