-
-
Notifications
You must be signed in to change notification settings - Fork 174
Implement keyboard navigation for BTable components #2834
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
Conversation
|
|
- Add tabindex support for sortable headers and selectable rows - Implement keyboard event handlers for Enter/Space and arrow keys - Add Home/End navigation for jumping to first/last row - Include comprehensive test suite for keyboard functionality - Support both BTable and BTableLite components - Maintain backward compatibility with existing features Co-authored-by: VividLemon <[email protected]>
|
Hi @VividLemon, Note that my implementation is heavily inspired by what was done in the bootstrap-vue project. The main difference is that I also handle the tab event in some cases. I hope this is useful. |
|
@copilot we want to avoid making new props when they're for internal use only. Instead set up a provide/inject bus that communicates the information internally. |
Co-authored-by: VividLemon <[email protected]>
Implemented provide/inject pattern as requested. The internal props |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
VividLemon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it worked well
commit: |
* upstream/main: (32 commits) chore: release main (bootstrap-vue-next#2838) feat(BButtonToolbar): Add keyboard navigation support (bootstrap-vue-next#2837) fix(BFormSelect): modelValue not being applied during SSR (bootstrap-vue-next#2835) feat(BTable): Implement keyboard navigation (bootstrap-vue-next#2834) fix: BOffcanvas responsive SSR compatibility - defer breakpoint evaluation to client-side (bootstrap-vue-next#2833) chore: release main (bootstrap-vue-next#2831) fix(BDropdown): transition broken by inline display styles (bootstrap-vue-next#2832) feat: change useColorMode selector from 'body' to 'html' (bootstrap-vue-next#2830) chore: release main (bootstrap-vue-next#2817) feat: Add headerAttrs prop to BOffcanvas and BModal components docs: Add useScrollspy documentation fix: Remove lazy-modifier warning on FormInput docs (bootstrap-vue-next#2825) feat(BSort)!: Implement initial-sort-direction and move compare from sort-by to fields (bootstrap-vue-next#2777) docs(table): fix incorrect list item (bootstrap-vue-next#2823) docs: Fix grammar in documentation data files (bootstrap-vue-next#2816) doc(BTooltip): Parity pass (bootstrap-vue-next#2762) docs(BOverlay): Parity pass (bootstrap-vue-next#2767) feat: implement BFormRating disabled state (bootstrap-vue-next#2753) (bootstrap-vue-next#2793) docs: fix otp for index and reference pages (bootstrap-vue-next#2819) docs(BApp): add some additional details around legacy plugin use (bootstrap-vue-next#2820) ...
This PR implements comprehensive keyboard accessibility for BTable components, bringing the functionality in line with the original Bootstrap-vue implementation. The keyboard navigation enables users to interact with tables using only the keyboard, improving accessibility for users with disabilities and keyboard-only workflows.
Features Implemented
Header Navigation
tabindex="0"for keyboard focusRow Navigation
tabindex="0"when table is in selectable modeTechnical Implementation
The implementation uses Vue 3's provide/inject mechanism for internal communication between BTable and BTableLite components. BTable provides keyboard navigation state through a
tableKeyboardNavigationKeyinjection, which BTableLite consumes to determine when to enable keyboard functionality based on:selectable: trueandnoSelectOnClick: false)Key technical details:
Testing
Added comprehensive test suite (
table-keyboard.spec.ts) covering:Demo
The screenshot shows the working keyboard navigation demo with:
Usage Example
Keyboard interactions:
Fixes #1259.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.