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

fix(ui5-dynamic-page): validate aria-controls reference before rendering #11033

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NakataCode
Copy link
Contributor

@NakataCode NakataCode commented Mar 7, 2025

Problem:

  • Invalid ARIA attributes were being generated when the referenced header element wasn't available with the exact ID.

Solution:

  • Remove _accAttributesForHeaderActions because the header and the (pin/unpin/expand/collapse) actions exist in separate shadow DOMs.

Fixes: #10987

@NakataCode NakataCode marked this pull request as ready for review March 7, 2025 13:25
@dobrinyonkov
Copy link
Contributor

The aria-controls attribute only functions within the same shadow DOM scope. In this case, the header and the (pin/unpin/expand/collapse) actions exist in separate shadow DOMs. This is why the AXE tool initially reported an error—it couldn't locate the header element within the shadow DOM of the actions.

There is ongoing development in this area, and the ElementInternals.ariaControlsElements API (still a work in progress) may eventually provide a solution. Unfortunately, until it's fully supported, we can't improve the situation. I recommend removing the aria-controls-related code for now and revisiting it once the new API becomes available.

Note: this.querySelector returns null because it searches in the "light" DOM, where the custom element, slots, and other elements are defined. To query within the Shadow DOM, you need to use this.shadowRoot!.querySelector, which will locate the header once the component is rendered. However, despite this, the error mentioned above still occurs.

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.

DynamicPage: ARIA attributes must conform to valid values - [a11y issue]
2 participants