Skip to content

FORMS-18673: Visual heading text is not marked as heading @sunnym @vavarshn #1563

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

stefan-dragomir
Copy link

@stefan-dragomir stefan-dragomir commented Mar 21, 2025

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • 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 change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@vaibhav2601 vaibhav2601 requested a review from rismehta March 25, 2025 08:48
@vaibhav2601 vaibhav2601 requested a review from sakshi-arora1 May 6, 2025 08:45
Copy link
Contributor

@sakshi-arora1 sakshi-arora1 left a comment

Choose a reason for hiding this comment

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

how level is being decided as there can be container inside container


const bemClass = Array.from(this.element.classList).filter(bemClass => !bemClass.includes('--'))[0];
if (bemClass && this.label.parentElement.classList.contains(`${bemClass}__label-container`)) {
this.label.setAttribute(Constants.ROLE, "heading");
Copy link
Contributor

Choose a reason for hiding this comment

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

role="heading" is not required on a label container. Labels are already accessible using the for attribute and the corresponding id.

const bemClass = Array.from(this.element.classList).filter(bemClass => !bemClass.includes('--'))[0];
const labelContainer = this.element.querySelector(`.${bemClass}__label-container`);
if (labelContainer) {
labelContainer.querySelector("label").setAttribute(Constants.ROLE, "heading");
Copy link
Contributor

Choose a reason for hiding this comment

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

role="heading" is not required on a label container. Labels are already accessible using the for attribute and the corresponding id.

Copy link
Contributor

@amit-mnnit amit-mnnit left a comment

Choose a reason for hiding this comment

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

Please check comments

@CezarSTF
Copy link

Hello @amit-mnnit !
The ticket requires these components to be marked as headings; this is why the heading role was added.

Also, the description of FORMS-18673 suggests this fix:
"When retrofitting legacy markup, using the role="heading" attribute, combined with the aria-level attribute, can be a useful way to add heading semantics to markup without the risk of breaking any styles that might be attached to the legacy markup. The aria-level attribute value is heading level desired."
After discussing with @sakshi-arora1, we decided that only the role="heading" should be added.

In the description, you can also find these reference links:
"Deque University: https://dequeuniversity.com/class/semantic-structure/headings/real-headings
W3C-WAI tutorial: https://www.w3.org/WAI/tutorials/page-structure/headings/"

Please review and let me know if the fix is fine.

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.

4 participants