Skip to content

feat: adds alt prop for accessibility#39

Open
anechol wants to merge 1 commit intomainfrom
feature/add-alt-prop
Open

feat: adds alt prop for accessibility#39
anechol wants to merge 1 commit intomainfrom
feature/add-alt-prop

Conversation

@anechol
Copy link

@anechol anechol commented May 5, 2025

Description

Adds alt prop for accessibility purposes.

Since this component has a role of img, an aria-label or equivalent is required to serve as the primary alternative text. Adding an alt prop option helps improve a11y by providing additional information in cases where the icon does not render in the browser.

Icon docs will updated in a separate PR for the Pine repo.

DSS-1386

Type of change

Please delete options that are not relevant.
If your type of change is not present, add that option.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests you've added and run to verify your changes.
Provide instructions so that we can reproduce.
Please also list any relevant details for your test configuration.

  • unit tests
  • e2e tests
  • accessibility tests
  • tested manually
  • other:

Test Configuration:

  • Pine versions:
  • OS:
  • Browsers:
  • Screen readers:
  • Misc:

Checklist:

If not applicable, leave options unchecked.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Design has QA'ed and approved this PR

@anechol anechol self-assigned this May 5, 2025
@netlify
Copy link

netlify bot commented May 5, 2025

Deploy Preview for pine-icons ready!

Name Link
🔨 Latest commit fe2da4c
🔍 Latest deploy log https://app.netlify.com/sites/pine-icons/deploys/6818e87fc9eb3f000883958a
😎 Deploy Preview https://deploy-preview-39--pine-icons.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

/**
* The `alt` attribute of the icon.
*/
"alt"?: string;
Copy link
Member

@pixelflips pixelflips May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we considered using aria-hidden="true" instead of alt="" and role="img"? Since we typically use them as just decorative icons, it might avoid sending mixed signals to screen readers.

I briefly tried to find any usage of standalone icons (outside of button, link, etc), but haven't so far. Just an additional thought, and I may not fully be understanding the problem with the image role and the aria-label.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be an option, yes. There's different avenues we can pursue for this. I added a quick meeting on the books to discuss the broader aspect of accessibility in Pine with our inherited attributes utility.

@anechol anechol removed their assignment Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants