Skip to content

fix: add role="region" to flex layout div with aria-label for WCAG 2.2 compliance#75

Open
iago1501 wants to merge 3 commits into
masterfrom
fix/add-role-region-aria-label
Open

fix: add role="region" to flex layout div with aria-label for WCAG 2.2 compliance#75
iago1501 wants to merge 3 commits into
masterfrom
fix/add-role-region-aria-label

Conversation

@iago1501

@iago1501 iago1501 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds role="region" attribute to the flex layout <div> element that contains aria-label to fix an accessibility violation identified in external audit for kohlerqa account.

Why is this needed?

The current implementation uses aria-label on a <div> without an explicit role attribute. According to ARIA 1.2 specification, aria-label is a prohibited attribute on elements with implicit role="generic" (which is the default for <div> elements).

This violates:

  • WCAG 2.2 Level A - Criterion 4.1.2 (Name, Role, Value)
  • ARIA 1.2 specification - aria-label prohibited on generic role elements

How does this fix it?

By adding role="region", the element becomes a proper landmark that:

  • ✅ Accepts accessible names via aria-label
  • ✅ Is semantically appropriate for layout sections
  • ✅ Complies with ARIA 1.2 and WCAG 2.2 Level A standards

What changed?

Files modified:

  • react/FlexLayout.tsx - Added role="region" to the main flex layout div
  • CHANGELOG.md - Added entry for this fix

Testing

This change maintains backward compatibility and does not affect functionality - it only improves accessibility compliance.

Related PRs

  • flex-layout#71 (previous partial fix - added aria-label)
  • This PR completes the accessibility fix by adding the required role attribute

References

…2 compliance

Adds role="region" attribute to the flex layout div that contains aria-label to comply with:
- WCAG 2.2 Level A criterion 4.1.2 (Name, Role, Value)
- ARIA 1.2 specification (aria-label is prohibited on elements with implicit role="generic")

The role="region" landmark is semantically appropriate for layout sections and allows proper use of aria-label as an accessible name.
@iago1501 iago1501 requested a review from a team as a code owner July 3, 2026 20:44
@iago1501 iago1501 requested review from RodrigoTadeuF, leo-prange-vtex and vsseixaso and removed request for a team July 3, 2026 20:44
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

iago1501 added 2 commits July 3, 2026 17:47
Previous commit accidentally truncated the changelog. This commit restores all historical entries while keeping the new accessibility fix entry in [Unreleased].
Complete fix restoring missing last line "- `flex-row` and `flex-col` blocks."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant