From 02d81f09ef4096eae0d04e3f904e8c9a51bc09b8 Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Wed, 13 Sep 2023 11:08:53 -0500 Subject: [PATCH 01/20] fix(multiselect): calculate scroll width for title for truncation (#14626) * fix(multiselect): calculate scroll width for title for truncation * chore: clean up code duplication --- packages/react/src/components/ListBox/ListBoxMenuItem.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/ListBox/ListBoxMenuItem.tsx b/packages/react/src/components/ListBox/ListBoxMenuItem.tsx index fd7bb497db89..0a0c18d2d72d 100644 --- a/packages/react/src/components/ListBox/ListBoxMenuItem.tsx +++ b/packages/react/src/components/ListBox/ListBoxMenuItem.tsx @@ -15,7 +15,9 @@ function useIsTruncated(ref) { const [isTruncated, setIsTruncated] = useState(false); useEffect(() => { - const { offsetWidth, scrollWidth } = ref.current; + const element = ref.current; + const { offsetWidth, scrollWidth } = + element.lastElementChild?.lastElementChild || element; setIsTruncated(offsetWidth < scrollWidth); }, [ref, setIsTruncated]); From 1cb7cd70a455680827ef7f7fd80ca279626ec056 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Thu, 14 Sep 2023 09:24:26 -0400 Subject: [PATCH 02/20] chore(ci): change lint:styles to only target scss files (#14647) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d96532068150..75fbc62b27a3 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "format": "prettier --cache --write '**/*.{js,md,scss,ts,tsx}' '!**/{build,es,lib,storybook,ts,umd}/**'", "format:diff": "prettier --list-different '**/*.{js,md,scss,ts,tsx}' '!**/{build,es,lib,storybook,ts,umd}/**' '!packages/components/**'", "lint": "eslint actions config packages www", - "lint:styles": "stylelint '**/*.{css,scss}' --report-needless-disables --report-invalid-scope-disables", + "lint:styles": "stylelint '**/*.scss' --report-needless-disables --report-invalid-scope-disables", "sync": "carbon-cli sync", "test": "cross-env BABEL_ENV=test jest", "test:e2e": "cross-env BABEL_ENV=test jest -c jest.e2e.config.js", From 47ff517f838e2ba6c2d4b141cd62caa9b04ffee2 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Thu, 14 Sep 2023 10:08:56 -0400 Subject: [PATCH 03/20] fix(DataTable): don't set unique name for each radio input (#14644) * fix(DataTable): don't set unique name for each radio input * test(DataTable): update snapshots * fix(DataTable): build with latest icons --- .../src/components/DataTable/DataTable.tsx | 2 +- .../__snapshots__/DataTable-test.js.snap | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/react/src/components/DataTable/DataTable.tsx b/packages/react/src/components/DataTable/DataTable.tsx index 47f32b2c3eb3..310d7c93af78 100644 --- a/packages/react/src/components/DataTable/DataTable.tsx +++ b/packages/react/src/components/DataTable/DataTable.tsx @@ -632,7 +632,7 @@ class DataTable extends React.Component< onClick, ]), id: `${this.getTablePrefix()}__select-row-${row.id}`, - name: `select-row-${row.id}`, + name: `select-row`, ariaLabel: t(translationKey), disabled: row.disabled, radio: this.props.radio || null, diff --git a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap index 61255fbb3ebe..a00dbc7d6598 100644 --- a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap +++ b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap @@ -61,7 +61,7 @@ exports[`DataTable behaves as expected selection -- radio buttons should not hav @@ -97,7 +97,7 @@ exports[`DataTable behaves as expected selection -- radio buttons should not hav @@ -133,7 +133,7 @@ exports[`DataTable behaves as expected selection -- radio buttons should not hav @@ -227,7 +227,7 @@ exports[`DataTable behaves as expected selection -- radio buttons should render @@ -263,7 +263,7 @@ exports[`DataTable behaves as expected selection -- radio buttons should render @@ -299,7 +299,7 @@ exports[`DataTable behaves as expected selection -- radio buttons should render @@ -675,7 +675,7 @@ exports[`DataTable behaves as expected selection should render and match snapsho