Skip to content

fix: remove redundant role="img" when lazyLoad is enabled#250

Merged
ibrahimcesar merged 1 commit intomainfrom
fix/249-remove-redundant-role-img-lazyload
Feb 17, 2026
Merged

fix: remove redundant role="img" when lazyLoad is enabled#250
ibrahimcesar merged 1 commit intomainfrom
fix/249-remove-redundant-role-img-lazyload

Conversation

@ibrahimcesar
Copy link
Owner

Summary

Fixes #249

When lazyLoad={true}, the component renders an actual <img> element inside the container for the thumbnail. However, the container also had role="img" applied, creating redundant ARIA semantics that fail automated accessibility audits (Axe, Lighthouse, WAVE).

  • Conditionally apply role="img" only when lazyLoad is not enabled and the iframe is inactive
  • When lazyLoad is enabled, the real <img> element already provides correct semantics for assistive technologies
  • When lazyLoad is disabled (CSS background-image), role="img" is still applied since there's no native image element
  • Bumps version from 3.3.3 to 3.4.0

Test plan

  • All 51 existing tests pass
  • Verify with lazyLoad={true}: container should not have role="img", the inner <img> handles semantics
  • Verify with lazyLoad={false} (default): container should still have role="img" as before
  • Run accessibility audit (Axe/Lighthouse) β€” redundant role error should be resolved

πŸ€– Generated with Claude Code

Bump version to 3.4.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

size-limit report πŸ“¦

Path Size
ES Module 3.08 KB (+0.23% πŸ”Ί)
CommonJS 3.09 KB (+0.29% πŸ”Ί)
CSS 1.25 KB (0%)

@ibrahimcesar ibrahimcesar merged commit f90e8fe into main Feb 17, 2026
7 checks passed
@ibrahimcesar
Copy link
Owner Author

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.

Issue: Redundant role="img" on video container causes a11y errors when lazyLoad={true}

1 participant