This is the content.
diff --git a/src/__snapshots__/QrCode.test.tsx.snap b/src/__snapshots__/QrCode.test.tsx.snap
index 701f427b0..484ad72c9 100644
--- a/src/__snapshots__/QrCode.test.tsx.snap
+++ b/src/__snapshots__/QrCode.test.tsx.snap
@@ -2,7 +2,7 @@
exports[`QrCode > renders 1`] = `
renders 1`] = `
{
);
await user.click(screen.getByRole("button", { name: "Microphone" }));
- screen.getByRole("menuitem", { name: "Microphone 1" });
- screen.getByRole("menuitem", { name: "Microphone 2" });
+ screen.getByRole("menuitemradio", { name: "Microphone 1" });
+ screen.getByRole("menuitemradio", { name: "Microphone 2" });
await user.keyboard("[Escape]");
await user.click(screen.getByRole("button", { name: "Camera" }));
- screen.getByRole("menuitem", { name: "Camera 1" });
- screen.getByRole("menuitem", { name: "Camera 2" });
+ screen.getByRole("menuitemradio", { name: "Camera 1" });
+ screen.getByRole("menuitemradio", { name: "Camera 2" });
});
test("calls select callback on menu click", async () => {
@@ -206,7 +206,9 @@ describe("MediaMuteAndSwitchButton", () => {
);
await user.click(getByRole("button", { name: "Microphone" }));
- await user.click(screen.getByRole("menuitem", { name: "Microphone 2" }));
+ await user.click(
+ screen.getByRole("menuitemradio", { name: "Microphone 2" }),
+ );
expect(onSelect).toHaveBeenCalledWith("mic2");
});
@@ -228,7 +230,9 @@ describe("MediaMuteAndSwitchButton", () => {
);
await user.click(getByRole("button", { name: "Microphone" }));
- await user.click(screen.getByRole("menuitem", { name: "Microphone 1" }));
+ await user.click(
+ screen.getByRole("menuitemradio", { name: "Microphone 1" }),
+ );
expect(onSelect).not.toHaveBeenCalled();
});
@@ -264,18 +268,24 @@ describe("MediaMuteAndSwitchButton", () => {
const { getByRole } = renderComponent( );
await user.click(getByRole("button", { name: "Microphone" }));
- await user.click(screen.getByRole("menuitem", { name: "Microphone 2" }));
+ await user.click(
+ screen.getByRole("menuitemradio", { name: "Microphone 2" }),
+ );
expect(onSelectPressed).toHaveBeenCalled();
expect(onOptionUpdated).not.toHaveBeenCalled();
// After clicking, plannedSelection="mic2" but selectedOption is still "mic1",
- // so a spinner should appear on the mic2 item
- const mic2Item = screen.getByRole("menuitem", { name: "Microphone 2" });
- expect(mic2Item.querySelector(".rotate")).toBeTruthy();
+ // so mic2 should be in an activating state
+ screen.getByRole("menuitemradio", {
+ name: "Microphone 2 Activating…",
+ checked: false,
+ });
- // The currently-selected mic1 item should not have a spinner
- const mic1Item = screen.getByRole("menuitem", { name: "Microphone 1" });
- expect(mic1Item.querySelector(".rotate")).toBeNull();
+ // The currently-selected mic1 item should not be activating
+ screen.getByRole("menuitemradio", {
+ name: "Microphone 1",
+ checked: true,
+ });
await act(async () => {
// resolve the promise that acutally updates the select option.
resolve();
@@ -284,7 +294,7 @@ describe("MediaMuteAndSwitchButton", () => {
expect(onOptionUpdated).toHaveBeenCalled();
// Spinner should now be gone since the selection has caught up
- const mic2ItemAfter = screen.getByRole("menuitem", {
+ const mic2ItemAfter = screen.getByRole("menuitemradio", {
name: "Microphone 2",
});
expect(mic2ItemAfter.querySelector(".rotate")).toBeNull();
@@ -336,11 +346,15 @@ describe("MediaMuteAndSwitchButton", () => {
await user.click(getByRole("button", { name: "Microphone" }));
// The selected item (mic2) renders both an IconOptions SVG and a CheckIcon SVG
- const mic1Item = screen.getByRole("menuitem", { name: "Microphone 2" });
+ const mic1Item = screen.getByRole("menuitemradio", {
+ name: "Microphone 2",
+ });
expect(mic1Item.querySelectorAll("svg").length).toBe(2);
// The unselected item (mic1) only renders its IconOptions SVG
- const mic2Item = screen.getByRole("menuitem", { name: "Microphone 1" });
+ const mic2Item = screen.getByRole("menuitemradio", {
+ name: "Microphone 1",
+ });
expect(mic2Item.querySelectorAll("svg").length).toBe(1);
});
});
diff --git a/src/components/MediaMuteAndSwitchButton.tsx b/src/components/MediaMuteAndSwitchButton.tsx
index bd220330f..3e344dd3a 100644
--- a/src/components/MediaMuteAndSwitchButton.tsx
+++ b/src/components/MediaMuteAndSwitchButton.tsx
@@ -191,6 +191,7 @@ export const MediaMuteAndSwitchButton: FC = ({
width={24}
height={24}
className={styles.itemIcon}
+ aria-hidden
/>
)
}
@@ -201,10 +202,23 @@ export const MediaMuteAndSwitchButton: FC = ({
onSelect?.(id);
}}
key={id}
+ role="menuitemradio"
+ aria-checked={selectedOption === id}
>
- {selectedOption === id && }
+ {selectedOption === id && (
+
+ )}
{selectedOption !== id && plannedSelection === id && (
-
+
)}
);
diff --git a/src/components/__snapshots__/MediaMuteAndSwitchButton.test.tsx.snap b/src/components/__snapshots__/MediaMuteAndSwitchButton.test.tsx.snap
index 8fe77ef11..dbab3b85d 100644
--- a/src/components/__snapshots__/MediaMuteAndSwitchButton.test.tsx.snap
+++ b/src/components/__snapshots__/MediaMuteAndSwitchButton.test.tsx.snap
@@ -3,7 +3,7 @@
exports[`MediaMuteAndSwitchButton > renders 1`] = `
renders 1`] = `
aria-expanded="false"
aria-haspopup="menu"
aria-label="Microphone"
- class="_button_1nw83_8 menuButton _has-icon_1nw83_60 _icon-only_1nw83_53"
+ class="_button_1nw83_8 _menuButton_e649de _has-icon_1nw83_60 _icon-only_1nw83_53"
data-kind="tertiary"
data-size="lg"
data-state="closed"
diff --git a/src/reactions/__snapshots__/RaisedHandIndicator.test.tsx.snap b/src/reactions/__snapshots__/RaisedHandIndicator.test.tsx.snap
index 43c3f9280..ca8ecfb08 100644
--- a/src/reactions/__snapshots__/RaisedHandIndicator.test.tsx.snap
+++ b/src/reactions/__snapshots__/RaisedHandIndicator.test.tsx.snap
@@ -2,10 +2,10 @@
exports[`RaisedHandIndicator > renders a smaller indicator when miniature is specified 1`] = `