Skip to content

fix(web): make sortable grid column headers keyboard accessible - #42471

Open
Miodrag Obradovic (Kjubikstronk) wants to merge 1 commit into
microsoft:mainfrom
Kjubikstronk:gridview-sortable-headers-keyboard
Open

fix(web): make sortable grid column headers keyboard accessible#42471
Miodrag Obradovic (Kjubikstronk) wants to merge 1 commit into
microsoft:mainfrom
Kjubikstronk:gridview-sortable-headers-keyboard

Conversation

@Kjubikstronk

Copy link
Copy Markdown

The sortable column headers in GridView carry their onClick on a plain <div> with no role, no tabIndex and no key handler, so they cannot be reached or activated from the keyboard and are not announced as controls. GridView backs the trace viewer's Network tab, so sorting by Name, Method, Status, Content-Type, Size or Duration is keyboard-inaccessible.

This follows the pattern from #42310 and #42336 and uses a real <button> with all: unset rather than role="button" on a div, with the same :focus-visible outline treatment as .expandable-title-button.

The button is only rendered when the grid is actually sortable. Previously the header was always clickable and the handler was guarded with model.setSorting &&, but toggleSorting already does model.setSorting?.() internally, so that guard was redundant. Moving the condition to render time means a non-sortable column no longer presents an inert clickable element.

One test in trace-viewer.spec.ts, written in the style of the one added in #42449: focus the Name header, confirm focus, press Enter, and assert the 404 request sorts to the top. The default order is frame.html, style.css, 404, script.js per the existing should have network requests test, so that assertion is not vacuous. Without the change the test fails at the first assertion, because no button exists to find.

Verified locally on chromium: the full trace-viewer.spec.ts passes at 121/121, and every test matching network passes at 152 passed / 5 skipped. tsc reports nothing in packages/web and eslint is clean on the changed file.

I did not add aria-sort, since doing it properly needs role="columnheader" inside role="row"/role="grid" and that restructures the component. Happy to follow up separately if you would like the full grid semantics.

@Kjubikstronk

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

1 similar comment
@Kjubikstronk

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8305 passed, 1367 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

6 flaky ⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:356 › screencast › should work for popups `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`

51283 passed, 1242 skipped


Merge workflow run.

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.

1 participant