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

Allow link elements in lieu of click handlers #31

Open
harrislapiroff opened this issue Apr 25, 2023 · 2 comments · May be fixed by #32
Open

Allow link elements in lieu of click handlers #31

harrislapiroff opened this issue Apr 25, 2023 · 2 comments · May be fixed by #32
Labels
enhancement New feature or request

Comments

@harrislapiroff
Copy link

Is your feature request related to a problem? Please describe.

We're run into some challenges using react-animated-dataset to build accessible visualizations—in particular using <a> link elements for handling click behavior instead of click handlers will get us a slough of native browser accessibility affordances.

Describe the solution you'd like

I'm not entirely sure the best solution here. I could imagine this going two ways:

  1. provide a href/link prop on AnimatedDataset that will accept a URL and conditionally render a link tag around an element
  2. more generically, provide functionality for rendering more complex component trees than a single tag per datum (this could get quite complicated, though, I imagine)
@harrislapiroff harrislapiroff added the enhancement New feature or request label Apr 25, 2023
@caesarsol
Copy link
Contributor

caesarsol commented Apr 26, 2023

hi Harris,
if I understood correctly, you're trying to use this feature of <a> tags in SVG, and indeed it would be complex with the current iteration of this library.
have you tried an alternative approach, for example a tabindex on the SVG elements to make them focusable?

@harrislapiroff
Copy link
Author

Hi, @caesarsol! tabindex takes care of one affordance that <a> tags provide, but not all of them. Here's examples of some others:

  • Screenreaders identify them as links
  • Command/control-clicking on a link opens it in a new browser tab in most desktop browsers
  • Desktop browsers show a preview of the destination URL before clicking
  • Right-clicking on a link allows you to bookmark/save/copy etc.

Some of these can be accomplished with some additional javascript or markup, but I expect there's also affordances I can't anticipate that are provided that native links that we'd like to achieve without having to think too hard about it or reimplement browser native features.

We're working on an attempt at our own forked implementation that will allow nested components. If you're interested in looking over it, we'd be happy to put a PR back upstream when we're happy with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants