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

🌱 Refactor FilterSelectOptionProps #1802

Merged
merged 3 commits into from
Apr 8, 2024
Merged

Conversation

rszwajko
Copy link
Collaborator

Key points:

  1. do not extend PF SelectOptionProps interface - this allows to add
    custom props to the interface and provides better control what prop
    are forwarded to SelectOption
  2. remove key prop as it's a special prop used internally by React
  3. use value prop according to PF documentation - effectively replace
    previously used key prop
  4. add label prop - to be used as human friendly representation of the
    value
  5. add groupLabel prop
  6. add chipLabel prop - for cases where it differs from the label prop
    (main use case are tag items)

@rszwajko rszwajko requested review from ibolton336 and sjd78 March 28, 2024 16:56
@rszwajko rszwajko force-pushed the optionKey branch 2 times, most recently from d3fe67a to 953eb7f Compare April 3, 2024 09:51
@rszwajko rszwajko marked this pull request as ready for review April 3, 2024 09:51
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

Reading through the code and testing the general function of things and everything looks ok. However, the Tags dropdown is not working correctly anymore. It doesn't want to close when text is entered in the search box:

screencast-localhost_9000-2024.04.04-17_57_26.mp4

The type changes and the subsequent refactoring looks good.

The look of the multiselect looks ok, and it seems to behave properly if you don't type in search text. Only a problem with search text entered.

Key points:
1. do not extend PF SelectOptionProps interface - this allows to add
   custom props to the interface and provides better control what prop
   are forwarded to SelectOption
2. remove key prop as it's a special prop used internally by React
3. use value prop according to PF documentation - effectively replace
   previously used key prop
4. add label prop - to be used as human friendly representation of the
   value
5. add groupLabel prop
6. add chipLabel prop - for cases where it differs from the label prop
   (main use case are tag items)

Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
@rszwajko
Copy link
Collaborator Author

rszwajko commented Apr 5, 2024

@sjd78
the problem should be fixed in the recent force-push

@sjd78
Copy link
Member

sjd78 commented Apr 5, 2024

@sjd78 the problem should be fixed in the recent force-push

The menu now closes as expected. 😀

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

LGTM

Not new with this PR, but perhaps in a followup the behavior where the search text stays present when the dropdown closes is awkward:
image

The only way to remove the text without clearing the selected options is to backspace or highlight/delete it. The X button within the field clears the text AND the current selections. IDK if it is a problem, just is ambiguous and awkward.

@sjd78
Copy link
Member

sjd78 commented Apr 5, 2024

This PR looks to be a pre-req for #1815 which is a fix for 0.3.next. Therefore this PR should target 0.3.next and be cherry-picked.

@ibolton336, does that make sense to you?

@sjd78 sjd78 added this to the v0.3.1 milestone Apr 5, 2024
@sjd78 sjd78 added the cherry-pick/release-0.3 This PR should be cherry-picked to release-0.3 branch. label Apr 5, 2024
@sjd78 sjd78 removed this from the v0.3.1 milestone Apr 5, 2024
@rszwajko rszwajko merged commit d84d176 into konveyor:main Apr 8, 2024
7 checks passed
ibolton336 pushed a commit to ibolton336/tackle2-ui that referenced this pull request Apr 9, 2024
Key points:
1. do not extend PF SelectOptionProps interface - this allows to add
   custom props to the interface and provides better control what prop
   are forwarded to SelectOption
2. remove key prop as it's a special prop used internally by React
3. use value prop according to PF documentation - effectively replace
   previously used key prop
4. add label prop - to be used as human friendly representation of the
   value
5. add groupLabel prop
6. add chipLabel prop - for cases where it differs from the label prop
   (main use case are tag items)

Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
Signed-off-by: Ian Bolton <ibolton@redhat.com>
ibolton336 added a commit that referenced this pull request Apr 9, 2024
Key points:
1. do not extend PF SelectOptionProps interface - this allows to add
   custom props to the interface and provides better control what prop
   are forwarded to SelectOption
2. remove key prop as it's a special prop used internally by React
3. use value prop according to PF documentation - effectively replace
   previously used key prop
4. add label prop - to be used as human friendly representation of the
   value
5. add groupLabel prop
6. add chipLabel prop - for cases where it differs from the label prop
   (main use case are tag items)

Signed-off-by: Ian Bolton <ibolton@redhat.com>
Co-authored-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick/release-0.3 This PR should be cherry-picked to release-0.3 branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants