feat: GAUD-10424 alt attribute d2l icon - #7467
Conversation
|
Thanks for the PR! 🎉 We've deployed an automatic preview for this PR - you can see your changes here:
Note The build needs to finish before your changes are deployed. |
|
This is several years old, but possibly still relevant: At the time, the a11y experience was varied to say the least. Any chance you've seen this? If not, it would probably be good to review, and for us to do some x-browser, x--screen reader tests with this solution. |
|
I'm not sure we want to do this. Whenever this request has come up in the past, we've always reluctantly recommended that they just go |
|
Yeah, icon-only isn't a good practice imo. Sighted users not using a screen reader are still at a loss trying to figure out what it means. But I know we use icons like this a lot, and so to me, really addressing the issue means much more. |
|
Thanks to you, both Daves, for the feedback. I read the post (haven't seen it before @dbatiste ). We could try to implement a couple of the presented approaches and do the cross-browser testing as well. Now regarding to the solution @dlockhart . explained, imho I think that since SVGs are being exposed through our But my 2 cents here are:
|
Just to clarify what I meant: thus far, we've only ever recommended using Now having said that, there are definitely cases like the one behind this defect where So the question we need to answer here is: do we want to build in support for In retrospect, I wish we'd called this component |
I understand better now, thanks for the clarification. And yes, if we want to be retro-compatible with the existing implementations/usages of our component, then alt should not be "mandatory". Therefore we can start making this more as optional and add those attributes in places where they make sense (if that also make sense). So I would change a little this implementation by adding the role attribute not while fixing the svg but just when the alt text is provided maybe? That also would include to update our Daylight doc for d2l-icon to mention this new optional way of usage |
I think this is the key question. I might go out on a limb and suggest we always want these icons to be decorative for the reason I mentioned (sighted non-screen reader user unable to discern meaning of icon). Icons should never be used on their own to convey meaning. The meaning of some icons is fairly clear to me, many not-so. But that really depends on the user. I am sure there might be some edge cases where supporting alt text on icons might be helpful, but I also think it invites designers/developers to use them in this inaccessible way. |
jira
GAUD-10424
Description
Our
d2l-iconcomponent has some useful icons used on the LMS, like thetier1:dotwhich has one use on the content page to visually notify the user that there is a new message on a Discussion activity they are subscribed. Unfortunately for sighted impaired users, this is not enough. They rely on screen readers and the virtual navigation to get notified if needed, but screen readers are not able to interpret that icon because it is not accessible. This is not good since that icon actually accomplishes a purpose: Tell the user there is an update in the discussion (i.e., a new reply, a new post, etc.). Therefore screen readers should be able to interpret that icon as intended/designed.This pr accomplishes that by combining the
role="img"andaria-label="<image_description>"attributes.The role is being set inside the
fixSvg()function and thearia-labelcomes from the newaltattribute.