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

Potentially use SVG <title> over aria-label + Leaflet Tooltip methods #480

Closed
Malvoz opened this issue Jul 12, 2021 · 1 comment
Closed
Labels
basic styling Elements should only have basic and native-like styling (W3C TAG Components Guideline) simplification wontfix

Comments

@Malvoz
Copy link
Member

Malvoz commented Jul 12, 2021

<featurecaption>s are realized by:

  1. Setting aria-label on SVG <g> elements to provide the accessible name
  2. Enabling Leaflet tooltips (duplicating the aria-label, to be displayed on hover)

The SVG <title> element (as child of <g>) can be used to achieve both of the above. The native tooltip from <title> is visually similar - if not identical - to the title attribute.

Pros of SVG <title>:

  • Reduced code
  • Performs better than JS based tooltips
  • No "magic"! (i.e. same consideration as for popups: Replace popup implementation with popup event #403). MapML can instead specify that <featurecaption> should be treated similar to the SVG <title> element and/or the HTML global title attribute (in regards to displaying a native tooltip on hover)
  • Potentially avoid double speak in the future: If Leaflet were to ever make tooltips accessible to screen readers (i.e. apply role="tooltip" or Live Region ARIA attributes) and we pull in that release then we'd have both the tooltip and aria-label announced by screen readers.

Cons:

  • Not possible to style native tooltips
  • Does not actively follow the cursor once displayed
  • Is not displayed on focus (only hover) 😕
@Malvoz
Copy link
Member Author

Malvoz commented Jul 13, 2021

  • Is not displayed on focus (only hover)

This is problematic (as explained in #327), and I suppose, a blocker for using native tooltips from <title> elements.

The good news is that Chromium is working on displaying tooltips from title attributes on focus (and SVG <title>). There's also a Firefox bug and WebKit bug.

I guess there's nothing else to do but to close this for now, may revisit in the future once there's some browser support for this.

@Malvoz Malvoz closed this as completed Jul 13, 2021
@Malvoz Malvoz added basic styling Elements should only have basic and native-like styling (W3C TAG Components Guideline) wontfix and removed enhancement labels Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
basic styling Elements should only have basic and native-like styling (W3C TAG Components Guideline) simplification wontfix
Projects
None yet
Development

No branches or pull requests

1 participant