Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WB-1671: Dropdown: use combobox role in all openers #2345

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tasty-rockets-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/wonder-blocks-dropdown": patch
---

Update dropdown openers to use `role="combobox"` instead of `button`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(very) nit: The ActionMenu also uses DropdownOpener and it still uses role="button"!

Suggested change
Update dropdown openers to use `role="combobox"` instead of `button`.
Update dropdown openers for SingleSelect and MultiSelect to use `role="combobox"` instead of `button`.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("SelectOpener", () => {

// Act
// Press the button.
await userEvent.click(await screen.findByRole("button"));
await userEvent.click(await screen.findByRole("combobox"));

// Assert
expect(onOpenMock).toHaveBeenCalledTimes(1);
Expand All @@ -51,7 +51,7 @@ describe("SelectOpener", () => {

// Act
// Press the button.
const button = await screen.findByRole("button");
const button = await screen.findByRole("combobox");
// NOTE: we need to use fireEvent here because await userEvent doesn't
// support keyUp/Down events and we use these handlers to override
// the default behavior of the button.
Expand Down Expand Up @@ -87,7 +87,7 @@ describe("SelectOpener", () => {

// Act
// Press the button.
const button = await screen.findByRole("button");
const button = await screen.findByRole("combobox");
// NOTE: we need to use fireEvent here because await userEvent doesn't
// support keyUp/Down events and we use these handlers to override
// the default behavior of the button.
Expand Down Expand Up @@ -131,7 +131,7 @@ describe("SelectOpener", () => {

// Act
// Press the button.
await userEvent.click(await screen.findByRole("button"));
await userEvent.click(await screen.findByRole("combobox"));

// Assert
expect(onOpenMock).toHaveBeenCalledTimes(0);
Expand All @@ -156,7 +156,7 @@ describe("SelectOpener", () => {

// Act
// Press the button.
const button = await screen.findByRole("button");
const button = await screen.findByRole("combobox");
// NOTE: we need to use fireEvent here because await userEvent doesn't
// support keyUp/Down events and we use these handlers to override
// the default behavior of the button.
Expand Down Expand Up @@ -192,7 +192,7 @@ describe("SelectOpener", () => {

// Act
// Press the button.
const button = await screen.findByRole("button");
const button = await screen.findByRole("combobox");
// NOTE: we need to use fireEvent here because await userEvent doesn't
// support keyUp/Down events and we use these handlers to override
// the default behavior of the button.
Expand Down Expand Up @@ -238,7 +238,7 @@ describe("SelectOpener", () => {
</SelectOpener>,
);
// Assert
expect(screen.getByRole("button")).toHaveAttribute(
expect(screen.getByRole("combobox")).toHaveAttribute(
"aria-invalid",
ariaInvalid,
);
Expand Down
Loading
Loading