Skip to content

Add keyboard navigation and row activation to QuickGrid - #70248

Merged
ilonatommy merged 8 commits into
dotnet:mainfrom
dariatiurina:dariatiurina-157-quickgrid-native-keyboard
Nov 10, 2026
Merged

ilonatommy merged 8 commits into
dotnet:mainfrom
dariatiurina:dariatiurina-157-quickgrid-native-keyboard

Conversation

@dariatiurina

@dariatiurina dariatiurina commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Add keyboard navigation and row activation to QuickGrid

Enable keyboard focus and Enter/Space activation for clickable QuickGrid rows.

Description

QuickGrid rows with OnRowClick currently respond to pointer clicks but are skipped by keyboard navigation. This change sets tabindex="0" on clickable rows so they participate in the natural Tab order while preserving native table semantics and nested control focus behavior.

Pressing Enter or Space when a clickable row is focused invokes its OnRowClick callback. When virtualized rows are rerendered, focus is preserved on the active row index (aria-rowindex).

Video for QuickGrid with Virtualize

virtualize.tab.mp4

Fixes dotnet/aspnetcore-scenario-tests#157

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Nov 2, 2026
Preserve the upstream virtualized ARIA row-count refresh together with real-data keyboard navigation bounds.

Co-authored-by: Copilot App <[email protected]>
@dariatiurina
dariatiurina marked this pull request as ready for review November 4, 2026 12:32
@dariatiurina
dariatiurina requested a review from a team as a code owner November 4, 2026 12:32
@dariatiurina
dariatiurina requested review from ilonatommy and a balanced review from Copilot November 4, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Focus restoration can fail in Firefox or target a nested grid, and repeated Space keydowns can cause unintended scrolling during row activation.

3 open issues
What changed in this PR

Adds keyboard navigation and activation to clickable QuickGrid rows while preserving native table semantics.

Changes:

  • Makes rows with OnRowClick focusable and adds Enter/Space activation.
  • Adds focus recovery logic for replaced virtualized rows.
  • Adds browser tests for keyboard activation and navigation that loads virtualized items.
File Description
src/​Components/​test/​testassets/​BasicTestApp/​QuickGridTest/​QuickGridScrollComponent.razor Adds row activation callbacks to the scrolling test fixture.
src/​Components/​test/​E2ETest/​Tests/​QuickGridTest.cs Adds keyboard activation and virtualized navigation tests.
src/​Components/​QuickGrid/​Microsoft.AspNetCore.Components.QuickGrid/​src/​QuickGrid.razor.js Handles keyboard activation and attempts focus recovery after row replacement.
src/​Components/​QuickGrid/​Microsoft.AspNetCore.Components.QuickGrid/​src/​QuickGrid.razor.cs Documents keyboard activation for OnRowClick.
src/​Components/​QuickGrid/​Microsoft.AspNetCore.Components.QuickGrid/​src/​QuickGrid.razor Adds conditional tabindex to clickable rows.

Review effort: Balanced

@dariatiurina
dariatiurina force-pushed the dariatiurina-157-quickgrid-native-keyboard branch from 067d2cd to 7685e49 Compare November 4, 2026 13:47
@PureWeen

PureWeen commented Nov 4, 2026

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Source-only review of frozen head 7685e497b7c0729d74a1fbe49ea0d7038c9fc215 found two P2 focus-restoration regressions, detailed inline.

Both routed guides completed independently with gpt-5.6-sol: Cross-Cutting Guidance and Blazor Components Guidance. The changed production path and E2E owner-layer coverage were assessed; browser/CI execution was excluded by the supplied-bundle boundary. No unresolved candidates or uncovered material changed areas remain.

Existing feedback was deduplicated neutrally: discussion r4467585882 (repeat-key scrolling), r4467585950 (restoration after removed focused rows), and r4467586000 (nested-grid selector scope) describe earlier code and are addressed in this frozen head; this is not an endorsement of those reviews. Feedback posted after bundle preparation is not observable.

Provenance: immutable version-2 bundle; head 7685e497b7c0729d74a1fbe49ea0d7038c9fc215, merge base f7d14ca402e8bb350148bfb64ad873e48c44f0b7, base tip and trusted guidance commit 1c94b15aa54d3d490d0ee060b7d496db3cb291e7. Proof is source-only. Tracked Git bytes only; symlink, submodule, and LFS targets cannot establish behavior.

Generated by ASP.NET Core Pull Request Review for #70248 · copilot · gpt56 · 174.8 AIC · ⌖ 12.3 AIC · ⊞ 18.8K
Comment /review to run again

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two additional focus-restoration issues remain at this commit: restoring a row can interrupt external editing or change the scroll position.

The browser evidence uses the unchanged module in Edge. It exercises native focus, DOM replacement, and scrolling, not a full QuickGrid application.

Human-directed and GitHub Copilot-generated.

@PureWeen

PureWeen commented Nov 5, 2026

Copy link
Copy Markdown
Member

/review

@PureWeen

PureWeen commented Nov 6, 2026

Copy link
Copy Markdown
Member

Copilot's local review panel found no blocking issues to raise at this commit.

Informational note (for author confirmation only — does not block agent-reviewed-approved):

  • src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor:79 ([DISCARDED] / verifier-discarded check): Setting tabindex="@(OnRowClick.HasDelegate ? 0 : (int?)null)" on each clickable <tr> creates a separate native Tab stop for every row on the page rather than a single grid Tab stop with arrow-key roving tabindex. Our review verifier discarded this because QuickGrid intentionally uses native sequential Tab navigation across clickable rows and does not implement arrow-key row roving; sharing here for author confirmation that per-row Tab stops are intended.

@ilonatommy

Copy link
Copy Markdown
Member

When virtualized rows are replaced during scrolling, focus is preserved on the active row index

Can you describe it from user perspective? Do you have any videos of the behavior? What is the "active row index"? Will scrolling to a new batch of callback items in virtualize keep the Nth element focused regardless of was is in this element?

@dariatiurina

Copy link
Copy Markdown
Contributor Author

When virtualized rows are replaced during scrolling, focus is preserved on the active row index

Can you describe it from user perspective? Do you have any videos of the behavior? What is the "active row index"? Will scrolling to a new batch of callback items in virtualize keep the Nth element focused regardless of was is in this element?

Yes, I updated description for you to see the video. Unless people use tab too fast and virtualize is not able to load items in-time, then the scrolling is working correctly.

@ilonatommy

Copy link
Copy Markdown
Member

When virtualized rows are replaced during scrolling, focus is preserved on the active row index

Can you describe it from user perspective? Do you have any videos of the behavior? What is the "active row index"? Will scrolling to a new batch of callback items in virtualize keep the Nth element focused regardless of was is in this element?

Yes, I updated description for you to see the video. Unless people use tab too fast and virtualize is not able to load items in-time, then the scrolling is working correctly.

I don't see the moment when rows are "replaced during scrolling". I think I still don't understand what happens then.

@dariatiurina

Copy link
Copy Markdown
Contributor Author

When virtualized rows are replaced during scrolling, focus is preserved on the active row index

Can you describe it from user perspective? Do you have any videos of the behavior? What is the "active row index"? Will scrolling to a new batch of callback items in virtualize keep the Nth element focused regardless of was is in this element?

Yes, I updated description for you to see the video. Unless people use tab too fast and virtualize is not able to load items in-time, then the scrolling is working correctly.

I don't see the moment when rows are "replaced during scrolling". I think I still don't understand what happens then.

"replaced" was actually meant to be "rerendered". Sorry for confusion :(

@ilonatommy
ilonatommy merged commit ddf0d01 into dotnet:main Nov 10, 2026
32 checks passed
@ilonatommy

Copy link
Copy Markdown
Member

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Documentation appears necessary, but a draft PR could not be created.

Confidence that documentation is needed: 85%

Drafted update to the QuickGrid article's OnRowClick Accessibility section for 12.0 keyboard behavior.

Documentation surfaces considered

  • Conceptual article: Required — QuickGrid.razor/.js changes add tabindex, Enter/Space activation and focus restoration, contradicting the existing Accessibility section.
  • Migration guidance: Not required — No user action needed when upgrading.
  • Breaking change: Not required — Additive keyboard behavior; no removed APIs or changed semantics that break existing code.

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 12, 2026
wtgodbe pushed a commit that referenced this pull request Nov 13, 2026
)

* Add keyboard navigation for clickable QuickGrid rows



* Simplify QuickGrid OnRowClick keyboard focus and activation



* Address PR review feedback on QuickGrid keyboard focus and Space keydown



* Refine QuickGrid row focus restoration on DOM replacement



* Restore QuickGrid focus by row index



* delete copied tests

* feedback

---------

Co-authored-by: Daria Tiurina <[email protected]>
Co-authored-by: Copilot App <[email protected]>

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — eb309a1a Deployed Nov 10, 2026 by ilonatommy via conclusion #257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-reviewed-approved area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants