From 39384f03c702ee83d7401cc021e91ed36a963c4c Mon Sep 17 00:00:00 2001 From: Joseph Schultz Date: Fri, 5 Jul 2024 08:52:00 -0500 Subject: [PATCH] feat(FilterableMultiSelect): assign given `id` to the listbox Pass the existing `id` prop to the rendered `ListBox` for parity with `MultiSelect`. --- .../src/components/MultiSelect/FilterableMultiSelect.tsx | 1 + .../MultiSelect/__tests__/FilterableMultiSelect-test.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx b/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx index 6b6bd8f25038..6c6d4a352c37 100644 --- a/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx +++ b/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx @@ -760,6 +760,7 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect< disabled={disabled} light={light} ref={ref} + id={id} invalid={invalid} invalidText={invalidText} warn={warn} diff --git a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js index a9f02f2329a0..111f2c5eb123 100644 --- a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js +++ b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js @@ -194,4 +194,11 @@ describe('FilterableMultiSelect', () => { `${prefix}--list-box__wrapper--slug` ); }); + + it('should place the given id on the listbox wrapper', async () => { + render(); + await waitForPosition(); + + expect(document.querySelector(`.${prefix}--list-box`).id).toBe('custom-id'); + }); });