Skip to content

Conversation

dariatiurina
Copy link
Contributor

Add aria-hidden attribute to spacers

Description

This pull request improves accessibility for the virtualization spacers in the Blazor Virtualize component by marking them as hidden from assistive technologies and updating related tests to verify this behavior.

Changes:

  • Added the aria-hidden="true" attribute to both top and bottom spacer elements rendered by the Virtualize component to ensure they are ignored by screen readers.
  • Updated multiple tests in VirtualizationTest.cs to assert that the spacer elements have the aria-hidden="true" attribute, ensuring the accessibility change is correctly applied.

Fixes #62989

@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label Aug 5, 2025
@dariatiurina dariatiurina self-assigned this Aug 5, 2025
@dariatiurina dariatiurina marked this pull request as ready for review August 5, 2025 09:27
@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 09:27
@dariatiurina dariatiurina requested a review from a team as a code owner August 5, 2025 09:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances accessibility for the Blazor Virtualize component by adding aria-hidden="true" attributes to spacer elements, preventing screen readers from announcing these purely visual layout elements to users.

  • Added aria-hidden="true" attribute to both top and bottom spacer elements in the Virtualize component
  • Updated E2E tests to verify the accessibility attributes are correctly applied
  • Ensures spacer elements are hidden from assistive technologies while maintaining visual layout functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Components/Web/src/Virtualization/Virtualize.cs Added aria-hidden="true" attributes to top and bottom spacer elements and adjusted attribute indices
src/Components/test/E2ETest/Tests/VirtualizationTest.cs Added assertions to verify spacer elements have the aria-hidden="true" attribute in multiple test scenarios

@ilonatommy ilonatommy added this to the 10.0-rc1 milestone Aug 5, 2025
@dariatiurina dariatiurina merged commit e6a2648 into dotnet:main Aug 5, 2025
30 checks passed
@dariatiurina dariatiurina deleted the 62989-virtualize-spacers-accessibility branch August 26, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Virtualize component spacers are not accessible

3 participants