-
Notifications
You must be signed in to change notification settings - Fork 955
feat(site): support icon and description in preset #19063
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
feat(site): support icon and description in preset #19063
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the workspace creation UI to support icon and description display for presets by replacing the SelectFilter
component with the more feature-rich Combobox
component.
- Replaces
SelectFilter
withCombobox
in the workspace creation form - Updates preset option structure to include icon and description fields
- Modifies
Combobox
to render preset icons usingExternalImage
instead ofAvatar
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx | Replaces SelectFilter with Combobox and updates preset options to include icon/description |
site/src/components/Combobox/Combobox.tsx | Updates icon rendering to use ExternalImage instead of Avatar |
@@ -103,7 +103,8 @@ export const SearchAndFilter: Story = { | |||
screen.queryByRole("option", { name: "Kotlin" }), | |||
).not.toBeInTheDocument(); | |||
}); | |||
await userEvent.click(screen.getByRole("option", { name: "Rust" })); | |||
// Accessible name includes both image alt text and text content: "Rust Rust" | |||
await userEvent.click(screen.getByRole("option", { name: "Rust Rust" })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we changed the icon image to be an ExternalImage with alt={option.displayName}
https://github.com/coder/coder/pull/19063/files#diff-f7c0d4d4c43b6dd17458ff44a1a0dfdccfae367b09ffe41fdbe09c48c151e466R126
The name includes both the image alt text (Rust
) + the text content (Rust
). Let me know if this is ok, or if there is a better way to filter out this element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to come in at the last minute (after things have been merged), but these test changes are papering over accessibility problems that the new code introduced. This is especially relevant, as there's a good chance that I'm going to be submitting a VPAT (Voluntary Product Accessibility Template) audit for coder/coder
sometime in H2 for Marketing/GTM
There's a reason why the testing library changed the accessible name to "Rust Rust"
– because that's the value that a screen reader will read out to a user who can't see. It's going to be super annoying for the user if they get doubled-up announcements as they cycle through every item in the options list
In my mind, what we can do instead is:
- Revert the accessible names for the test selectors to remove the duplicated values (so just
Rust
and justGo
, rather thanRust Rust
andGo Go
) - Set the alt text to an empty string
Alt text is only valuable if the content of the image isn't strictly decorative, and actually has semantic meaning that other content in the UI isn't capturing. Because we have the name right next to the image, we don't need the alt text. And or UI programming specifically, you can get away with empty alt text more often than you would think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Parkreiner Thank you for letting me know about this, this is really helpful context 👍
You're right: this PR introduced alt={option.displayName}
, which led to the repeated accessible name (e.g. "Rust Rust"). I hadn’t realized that would have a direct impact on screen readers, that's super useful to know.
I’ll go ahead and:
- Revert the
alt
attribute to use an empty string. - Update the tests to reflect the correct accessible names without duplication.
Appreciate you taking the time to call this out 🙂
Description
This PR updates the
CreateWorkspacePageView
to use theCombobox
React component instead ofSelectFilter
for the Preset selection.Changes
CreateWorkspacePageView
to use theCombobox
component in place ofSelectFilter
.Combobox
component to render preset icons usingExternalImage
instead ofAvatar
.Follow-up from: #18977