Fix checkbox column rendering when selection is not enabled#68
Merged
Conversation
Co-authored-by: py-bay <104859696+py-bay@users.noreply.github.com>
Co-authored-by: py-bay <104859696+py-bay@users.noreply.github.com>
Co-authored-by: py-bay <104859696+py-bay@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix checkbox column rendering without selection enabled
Fix checkbox column rendering when selection is not enabled
Oct 23, 2025
py-bay
approved these changes
Oct 23, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where checkbox columns were incorrectly rendered in tables that did not have selection enabled. The issue occurred because the condition checking config.selectable?.mode !== "none" evaluated to true when config.selectable was undefined, causing unwanted checkboxes to appear.
Key Changes:
- Updated the selection rendering logic to explicitly check for the existence of
config.selectablebefore evaluating the mode - Added example components to demonstrate correct behavior for tables with and without selection
- Enhanced documentation with comprehensive
SelectionConfigsection and usage examples
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/components/Table/components/Table.tsx |
Fixed the selectable prop logic to prevent checkboxes from rendering when selection is not configured |
src/components/Table/examples/NoSelectionExample.tsx |
Added example demonstrating a table without selection enabled |
src/components/Table/examples/SelectionComparisonExample.tsx |
Added comparison example showing tables with and without selection side-by-side |
src/components/Table/README.md |
Enhanced documentation with SelectionConfig section and usage examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
py-bay
approved these changes
Oct 23, 2025
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.
Problem
The Table component was incorrectly rendering checkbox/selection columns even when
enableSelection()was not called on the table builder. This caused consumer applications to see unwanted checkboxes in tables that were not intended to support row selection.Reproduction
Expected: No checkbox column
Actual: Checkbox column was rendered
Root Cause
The issue was in
src/components/Table/components/Table.tsxwhere theselectableprop was determined using:When
config.selectableisundefined(i.e.,enableSelection()was never called), the optional chaining evaluates toundefined !== "none", which istrue, causing checkboxes to render.Solution
Updated the condition to explicitly check for the existence of
config.selectable:This ensures checkboxes only render when:
config.selectableis explicitly defined (not undefined)Changes
Table.tsx(lines 211 and 223) for both MobileTable and DesktopTable componentsNoSelectionExample.tsxandSelectionComparisonExample.tsxto demonstrate correct behaviorSelectionConfigsection, usage examples, and important notes about explicit selection enablementTesting
enableSelection()no longer render checkboxesenableSelection()continue to work as expectedExamples
Table WITHOUT Selection (Fixed ✅)
Table WITH Selection (Still Works ✅)
Fixes #[issue-number]
Original prompt