From e1b3ef22c9ee09474bacadbb0b22b41326566bab Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 19 Mar 2025 12:43:05 -0700 Subject: [PATCH] fix(list-box): use `aria-disabled` instead of invalid `disabled` attribute (#2125) --- src/ListBox/ListBoxMenuItem.svelte | 2 +- tests/ComboBox/ComboBox.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ListBox/ListBoxMenuItem.svelte b/src/ListBox/ListBoxMenuItem.svelte index dd2ff422..569f0e9e 100644 --- a/src/ListBox/ListBoxMenuItem.svelte +++ b/src/ListBox/ListBoxMenuItem.svelte @@ -25,7 +25,7 @@ class:bx--list-box__menu-item--active={active} class:bx--list-box__menu-item--highlighted={highlighted || active} aria-selected={active} - disabled={disabled ? true : undefined} + aria-disabled={disabled ? true : undefined} {...$$restProps} on:click on:mouseenter diff --git a/tests/ComboBox/ComboBox.test.ts b/tests/ComboBox/ComboBox.test.ts index 2ac7534f..697031a8 100644 --- a/tests/ComboBox/ComboBox.test.ts +++ b/tests/ComboBox/ComboBox.test.ts @@ -165,7 +165,7 @@ describe("ComboBox", () => { await user.click(screen.getByRole("textbox")); const disabledOption = screen.getByText(/Fax/).closest('[role="option"]'); assert(disabledOption); - expect(disabledOption).toHaveAttribute("disabled", "true"); + expect(disabledOption).toHaveAttribute("aria-disabled", "true"); await user.click(disabledOption); expect(screen.getByRole("textbox")).toHaveValue("");