-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
✅ Deploy Preview for oslmap ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Looks like a great improvement from a visual pov! One small suggestion, as the styles are written with SCSS, set a variable (i.e |
Thanks @ianjon3s - good spot, now updated! I'm out of practice with stylesheets - always appreciate these tips 🙂 |
There was a problem hiding this 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.
There was a problem hiding this 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/index.ts
Outdated
// 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) => |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great solution - super simple 👍
A number of styling tweaks based on feedback from Planx's most recent accessibility audit:
staticMode
is set and attributions are not collapsedFuture scope / followup:
aria-label
on canvas element in shadow dom, not container div rendered by Lit