fix(table): make the column resize handle keyboard and touch accessible - #227
Merged
Merged
Conversation
The handle was a bare span carrying only onmousedown, with no role, no tabindex and no key handler. Keyboard users could not reach it at all, let alone resize a column. A probe measured the column staying at 150px after three arrow presses while a mouse drag moved it to 230px, and one Tab from a button above the table jumped straight past the whole table. The drag also listened for mousemove and mouseup on document, so touch and pen never started a resize, even though the element already carried touch-none and therefore blocked scrolling that began on it. It is now a focusable separator with aria-orientation, aria-valuenow, aria-valuemin, aria-valuemax and aria-valuetext, resized by the arrow keys with a larger step while shift is held, and by Home and End for the bounds. The drag moves onto usePointerDrag, which ColorPicker and Resizable already use, so every pointer type works. The svelte-ignore for static element interactions is gone, since the element is now interactive. One remains for the noninteractive tabindex rule, which misreads a separator carrying aria-valuenow as passive. That is the same false positive Resizable already suppresses. Closes #226
# Conflicts: # CHANGELOG.md
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The column resize handle was a bare
spancarrying onlyonmousedown, with no role, no tabindex and no key handler. I measured it before changing anything, with a mouse drag as the control case that proves the probe works:Tabbing from a button placed immediately above the table jumped straight past the whole table into the next component, so the table offered no keyboard stop for resizing at all.
The same wiring broke pointer input other than a mouse, because the drag listened for
mousemoveandmouseupondocument:The
touch-noneclass suggests touch was intended. As it stood the class blocked scrolling that began on the handle without offering anything back.Closes #226
Type of change
Changes
separatorwitharia-orientation,aria-valuenow,aria-valuemin,aria-valuemaxandaria-valuetext, so assistive technology can announce the current width.Homegoes tominWidthandEndtomaxWidth, andEndis inert on a column that sets no maximum.usePointerDrag, the hookColorPickerandResizablealready use, so touch and pen work instead of a mouse alone. This also removes the manualdocumentlisteners.resizingis a plain local instead of$state, since nothing reactive reads it.Accessibility notes
The
svelte-ignorefor static element interactions is gone, because the element is genuinely interactive now. One ignore remains, for the noninteractive tabindex rule, which reads aseparatoras passive and does not account for one carryingaria-valuenow. That is the same false positiveResizablealready suppresses, so the two controls are now consistent.Checklist
Closes #226)pnpm checkpasses (0 errors, 0 warnings)pnpm lintpassespnpm testpassesCHANGELOG.mdunder[Unreleased]*.types.ts, Material 3 design tokens)Notes
Verified on a throwaway page driven through a real browser, with one column bounded only at the bottom and another bounded at both ends:
Seven regression tests cover the separator attributes, focusability, arrow resizing, the shift step, clamping at the minimum, a touch pointer drag, and that a column without
resizablerenders no handle. The probe page is deleted.