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

Include aria-hidden attribute to Image shortcodes. #52

Open
3 tasks
cannandev opened this issue May 15, 2024 · 0 comments
Open
3 tasks

Include aria-hidden attribute to Image shortcodes. #52

cannandev opened this issue May 15, 2024 · 0 comments

Comments

@cannandev
Copy link

USWDS 3.0 adds an aria-hidden attribute to images. The two shortcodes image and image_with_class only have src, cls, alt parameters. It should also support an aria parameter.

Notes

Example: USWDS Banner

<img
  aria-hidden="true"
  class="usa-banner__header-flag"
  src="/assets/img/us_flag_small.png"
  alt=""
/>

Implementation notes

The imageWithClassShortcode function in index.js can be updated with a new parameter, whose default is true.

async function imageWithClassShortcode(
  src,
  cls,
  alt,
  aria=true,
) {
...
  return `<img src="${pathPrefix}${data.url}" class="${cls}" alt="${alt}" aria-hidden="${aria}" loading="lazy" decoding="async">`;
};

Acceptance Criteria

  • Images () are generated with an aria-hidden attribute, whose default value is true
  • Developers can pass a false value to the image and image_with_class shortcodes, if necessary
  • Instructions in the README.md are updated.

Thanks for all your hard work! 🙇🏾‍♀️

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

No branches or pull requests

1 participant