Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44d9356

Browse files
authored
fix(site): remove redundant alt text to prevent duplicated accessible names (#19087)
## DescriptionRemoves the redundant `alt` text in the `Combobox` component to preventscreen readers from announcing duplicated names (e.g. "Rust Rust").## Changes* Remove redundant `alt` text from `Combobox` `ExternalImage`* Update `Combobox` tests accordinglyRelated to:#19063 (comment)
1 parent4bced62 commit44d9356

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

‎site/src/components/Combobox/Combobox.stories.tsx‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ export const SearchAndFilter: Story = {
103103
screen.queryByRole("option",{name:"Kotlin"}),
104104
).not.toBeInTheDocument();
105105
});
106-
// Accessible name includes both image alt text and text content: "Rust Rust"
107-
awaituserEvent.click(screen.getByRole("option",{name:"Rust Rust"}));
106+
awaituserEvent.click(screen.getByRole("option",{name:"Rust"}));
108107
},
109108
};
110109

@@ -138,11 +137,9 @@ export const ClearSelectedOption: Story = {
138137
awaituserEvent.click(canvas.getByRole("button"));
139138
// const goOption = screen.getByText("Go");
140139
// First select an option
141-
// Accessible name includes both image alt text and text content: "Go Go"
142-
awaituserEvent.click(awaitscreen.findByRole("option",{name:"Go Go"}));
140+
awaituserEvent.click(awaitscreen.findByRole("option",{name:"Go"}));
143141
// Then clear it by selecting it again
144-
// Accessible name includes both image alt text and text content: "Go Go"
145-
awaituserEvent.click(awaitscreen.findByRole("option",{name:"Go Go"}));
142+
awaituserEvent.click(awaitscreen.findByRole("option",{name:"Go"}));
146143

147144
awaitwaitFor(()=>
148145
expect(canvas.getByRole("button")).toHaveTextContent("Select option"),

‎site/src/components/Combobox/Combobox.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const Combobox: FC<ComboboxProps> = ({
124124
<ExternalImage
125125
className="w-4 h-4 object-contain"
126126
src={option.icon}
127-
alt={option.displayName}
127+
alt=""
128128
/>
129129
) :(
130130
/* Placeholder for missing icon to maintain layout consistency */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp