Skip to content

Replace Listbox in Create Disk side modal with Combobox #2829

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

septum
Copy link

@septum septum commented May 20, 2025

This replaces the Listbox in snapshot and image source selections with a Combobox. Solving (hopefully) #2827.

combobox

combobox.mp4

Copy link

vercel bot commented May 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview May 29, 2025 8:56pm

@david-crespo
Copy link
Collaborator

Thank you! We will take a look soon.

isLoading={areImagesLoading}
items={images.map((i) => toImageComboboxItem(i, true))}
required
onInputChange={() => {
diskImageIdField.onChange()
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this do?

Copy link
Author

Choose a reason for hiding this comment

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

It allows the modification of the underlying text value after the selection of one item, otherwise, the text value changes only by selecting another item in the list and not by input events.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, and good catch. I think you can move this fix to the ComboboxField component by adding an onInputChange={() => field.onChange()} to the main Combobox props, fixing it for all Comboboxes.

It does seem like there's a funny interaction where selecting an option, then deleting some of the contents, then blurring the field by clicking outside the component then erases the selected option. Would there be a way to prevent that selected option from getting lost?

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good, I'll prepare a change for this.

For the first item: I'm guessing we should destructure onInputChange from the ComboboxField props and call it in a similar fashion as onChange (e.g. onInputChange?.(value)), right?

control={control}
name="diskSource.imageId"
label="Source image"
placeholder="Select an image"
placeholder="Select an image or enter an image name"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the original placeholder was sufficient in both cases.

Copy link
Author

@septum septum May 23, 2025

Choose a reason for hiding this comment

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

I would say that this placeholder would signal the user in a better way that they could search for a snapshot/image as opposed of just having the presence of the text cursor in the field.

It's worth noting that I'm not very familiarized with Oxide's userbase, so this comes from thin air :).

Copy link
Contributor

Choose a reason for hiding this comment

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

We might revisit placeholder copy in the future, but for now would want to keep the shorter version from before.

Copy link
Author

Choose a reason for hiding this comment

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

Done in 19621a5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants