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

fix: usability improvements #442

Merged
merged 5 commits into from
Apr 5, 2024
Merged

fix: usability improvements #442

merged 5 commits into from
Apr 5, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Apr 4, 2024

A number of styling tweaks based on feedback from Planx's most recent accessibility audit:

  • Control button focus color is now GOV.UK yellow for stronger contrast
  • Attribution link focus color is now GOV.UK yellow for stronger contrast
  • Tab order of control buttons and attribution links is now top to bottom, left to right
  • Tab index is omitted from map altogether in cases where staticMode is set and attributions are not collapsed

chrome-capture-2024-3-4

Future scope / followup:

  • How to set aria-label on canvas element in shadow dom, not container div rendered by Lit
  • Snap points color needs stronger contrast (another basemap altogether?)

Copy link

netlify bot commented Apr 4, 2024

Deploy Preview for oslmap ready!

Name Link
🔨 Latest commit 2e5244d
🔍 Latest deploy log https://app.netlify.com/sites/oslmap/deploys/660fb618fcaa2f00085a4bd3
😎 Deploy Preview https://deploy-preview-442--oslmap.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jessicamcinchak
Copy link
Member Author

@jessicamcinchak
Copy link
Member Author

@jessicamcinchak
Copy link
Member Author

Map focus [Usability]

@jessicamcinchak jessicamcinchak marked this pull request as ready for review April 4, 2024 10:30
@jessicamcinchak jessicamcinchak requested a review from a team April 4, 2024 10:31
@ianjon3s
Copy link
Contributor

ianjon3s commented Apr 4, 2024

Looks like a great improvement from a visual pov!

One small suggestion, as the styles are written with SCSS, set a variable (i.e $color-focus: #ffdd00;) to reuse the focus colour.

@jessicamcinchak
Copy link
Member Author

Thanks @ianjon3s - good spot, now updated! I'm out of practice with stylesheets - always appreciate these tips 🙂

Copy link
Contributor

@ianjon3s ianjon3s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving from a non-typescript perspective (@DafyddLlyr may want to add other comments), will be good to see a working example of this to test focus states etc.

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see tests added as always!

A few suggestions here - possibly something you've already tried.

src/components/my-map/styles.scss Outdated Show resolved Hide resolved
// Apply aria-labels to OL Controls for accessibility
const olControls: NodeListOf<HTMLButtonElement> | undefined =
this.renderRoot?.querySelectorAll(".ol-control button");
olControls?.forEach((node) =>
node.setAttribute("aria-label", node.getAttribute("title") || ""),
);

// Apply tabindexes to OL Controls & Attribution links for accessibility (container div has starting tabindex="1")
const controlsLength = olControls?.length;
olControls?.forEach((node, i) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the order of these in the DOM is determined by their order in the collection of map controls.

We set up defaults, then based on props, append new ones. This is why the variable ones come after the defaults (e.g. attribution).

Totally fair if you've already explored this one, but it might be worth trying to just manage this via the order they're added to the map controls? Main motivations here would be simplicity (arguable depending on how that works out!), and also the general recommendation to to not use tabindex unless totally required -

Warning: You are recommended to only use 0 and -1 as tabindex values. Avoid using tabindex values greater than 0 and CSS properties that can change the order of focusable HTML elements (Ordering flex items). Doing so makes it difficult for people who rely on using keyboard for navigation or assistive technology to navigate and operate page content. Instead, write the document with the elements in a logical sequence.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sorted now by re-ordering, no longer having to rely on positive tab indexes!

    // Re-order overlay elements so that OL Attribution is final element
    //   making OL Controls first in natural tab order for accessibility
    const olAttribution = this.renderRoot?.querySelector(".ol-attribution") as Node;
    const olOverlay = this.renderRoot?.querySelector(".ol-overlaycontainer-stopevent");
    olOverlay?.append(olAttribution);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great solution - super simple 👍

src/components/my-map/index.ts Outdated Show resolved Hide resolved
@jessicamcinchak jessicamcinchak merged commit 8b85edc into main Apr 5, 2024
5 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/a11y-adjustments branch April 5, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants