Skip to content

Commit 2b5f7d0

Browse files
authored
[IndexTable] Fix visual bug for sortable, selectable IndexTables (#7003)
### WHY are these changes introduced? Fixes a small visual bug where the IndexTable heading containing the checkbox doesn't get the same treatment as the other headings when an IndexTable is sortable. Before: <img width="801" alt="Screenshot 2022-08-24 at 10 45 48" src="https://user-images.githubusercontent.com/2562596/186387740-5685b68e-bb90-42ea-8f70-50eea0936ea9.png"> After: <img width="750" alt="Screenshot 2022-08-24 at 10 45 53" src="https://user-images.githubusercontent.com/2562596/186387819-1a4e7fae-af84-4f1e-b0be-b4cc4bf2d0c3.png"> ### 🎩 checklist - [x] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [x] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
1 parent 8afbfdf commit 2b5f7d0

File tree

3 files changed

+143
-137
lines changed

3 files changed

+143
-137
lines changed

.changeset/shy-jars-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Fix visual bug for sortable, selectable index table headings

polaris-react/src/components/IndexTable/IndexTable.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,10 @@ function IndexTableBase({
682682
function renderHeading(heading: IndexTableHeading, index: number) {
683683
const isSecond = index === 0;
684684
const isLast = index === headings.length - 1;
685+
const hasSortable = sortable?.some((value) => value === true);
685686
const headingContentClassName = classNames(
686687
styles.TableHeading,
687-
sortable?.some((value) => value === true) &&
688-
styles['TableHeading-sortable'],
688+
hasSortable && styles['TableHeading-sortable'],
689689
isSecond && styles['TableHeading-second'],
690690
isLast && !heading.hidden && styles['TableHeading-last'],
691691
!selectable && styles['TableHeading-unselectable'],
@@ -717,6 +717,7 @@ function IndexTableBase({
717717

718718
const checkboxClassName = classNames(
719719
styles.TableHeading,
720+
hasSortable && styles['TableHeading-sortable'],
720721
index === 0 && styles['TableHeading-first'],
721722
);
722723

0 commit comments

Comments
 (0)