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

lib: Support headers with SimpleSelect #21480

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

mvollmer
Copy link
Member

@mvollmer mvollmer commented Jan 2, 2025

Needed to replace the deprecated select in cockpit-machines.

Comment on lines +139 to +143
<SelectOption key={option.key}
isDisabled
className="ct-select-header">
{option.content}
</SelectOption>
Copy link
Contributor

Choose a reason for hiding this comment

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

These 5 added lines are not executed by any test.

@mvollmer
Copy link
Member Author

mvollmer commented Jan 3, 2025

I start to think we should just use SelectOption et al with SimpleSelect instead of the extra indirection via the { value: "foo", content: _("Bar") } objects. Those objects make sense for typeahead, since they make generic filtering trivial. But SimpleSelect has no need to look into the options.

In my defense, I just went with the template offered by PatternFly without questioning it...

@mvollmer mvollmer requested a review from tomasmatus January 3, 2025 12:23
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Putting SelectOptions into selects and such sounds good, as long as it's consistent (wrt. TypeaheadSelect as well). I'll let you decide if you want to go ahead with this PR (it looks nice, and doesn't really make the situation worse) to unblock the c-machines porting, or clean this up with SelectOption.

Thanks!

@mvollmer
Copy link
Member Author

mvollmer commented Jan 7, 2025

Putting SelectOptions into selects and such sounds good, as long as it's consistent (wrt. TypeaheadSelect as well).

I think we should keep TypeaheadSelect as it is. The explicit data structure (and its restriction to be a flat list) is very helpful for the generic filtering and key navigation. PF is improving key navigation and we might not need to implement it ourselves anymore, and we might move the filtering into the clients of TypeaheadSelect (so that the client only creates the list of SelectOptions after filtering).

But all PF examples for typeahead keep the custom key navigation, and it looks like the typeahead widget is supposed to keep the focus always on the text input, so that the user can type into it at all times, even in the middle of navigating the offered choices.

But this feels like more change/work than I want to take on right now.

So, hmm. This continues my general feeling about this work. Too many dilemmas and not enough help from PF.

Let's land this and stumble forward.

@mvollmer mvollmer merged commit 4d0bb13 into cockpit-project:main Jan 7, 2025
85 checks passed
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