sphinx-design
sphinx-design copied to clipboard
link-alt to fix card link accessibility not working for a page
Describe the bug
context When we make a page in RST with cards.
expectation I expected each card link to have a discernible name.
bug But instead there is no discernible name for the card link
problem This is a problem for people using screen readers because the screen reader will not speak to them a meaningful name for the link.
This seems to be a bug with #78.
Reproduce the bug
From the RST source, for the page that is built, Lighthouse still reports the issue Links do not have a discernible name.
RST includes:
.. grid:: 2
.. grid-item-card:: Tutorials :material-sharp:`school;3em;item-card-icon`
:link: tutorials
:link-type: ref
which seems to match the format given in the sphinx-design documentation.
List your environment
No response
Hey @bertiewooster, as mentioned in #78, this was closed in #89 by the addition of the link-alt option, have you tried using that?
@chrisjsewell thanks. Oh, I didn't realize that a card would have to have a new option link-alt.
My thinking was that the card would automatically use the name of the card (in the example below, Tutorials) as the name for the link. That way, documentation writers wouldn't have to do anything additional to meet accessibility guidelines, thus making pages accessible by default.
As it's set up now, it seems like adding link-alt as in the following example would do the trick? (I didn't find link-alt in the clickable cards documentation.)
.. grid-item-card:: Tutorials :material-sharp:`school;3em;item-card-icon`
:link: tutorials
:link-type: ref
:link-alt: Tutorials
cc @asmeurer
I believe this is fixed in #183