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

[CPT-1480] Prevent multiple Select from closing when search was clicked #4101

Conversation

toptalwadiibasmi
Copy link
Contributor

@toptalwadiibasmi toptalwadiibasmi commented Jan 16, 2024

CPT-1480

Description

The select input gains focus after clicking on a menu item only when the select is not multiple. This prevents it from closing on multiple selections when the user clicks/focuses on the search input.

How to test

Select (multiple)

  • Open the Picasso Select
  • Go to Limit section.
  • Click on the search input.
  • Then click on any option.
  • The search options should remain visible.

Select (single)

  • Open the Picasso Select
  • Go to Limit section.
  • Enter anything or click on the search
  • Click on any field.
  • The search options should close.

Development checks

Breaking change

  • codemod is created and showcased in the changeset
  • test alpha package of Picasso in StaffPortal

All development checks should be done and set checked to pass the
GitHub Bot: TODOLess action

PR commands

List of available commands:

  • @toptal-bot run package:alpha-release - Release alpha version
  • @toptal-anvil ping reviewers - Ping FX team for review
PR Review Guidelines

When to approve? ✅

You are OK with merging this PR and

  1. You have no extra requests.
  2. You have optional requests.
    1. Add nit: to your comment. (ex. nit: I'd rename this variable from makeCircle to getCircle)

When to request changes? ❌

You are not OK with merging this PR because

  1. Something is broken after the changes.
  2. Acceptance criteria is not reached.
  3. Code is dirty.

When to comment (neither ✅ nor ❌)

You want your comments to be addressed before merging this PR in cases like:

  1. There are leftovers like unnecessary logs, comments, etc.
  2. You have an opinionated comment regarding the code that requires a discussion.
  3. You have questions.

How to handle the comments?

  1. An owner of a comment is the only one who can resolve it.
  2. An owner of a comment must resolve it when it's addressed.
  3. A PR owner must reply with ✅ when a comment is addressed.

Copy link

changeset-bot bot commented Jan 16, 2024

🦋 Changeset detected

Latest commit: d9d5ab4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@toptal/picasso Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the contribution DO NOT ADD MANUALLY label Jan 16, 2024
@toptal-devbot
Copy link
Collaborator

Greetings from FX team, @toptalwadiibasmi 👋

Thank you so much for contributing 🙇

We have got high priority ticket generated on our Kanban board so we will do our best to make your experience supreme!

What's next? We will collaborate using this workflow. For you this practically means making sure DONE criteria is met and responding promptly to code review comments 😉

🙏 please, help us improve, rate your contributing experience after merge

@toptalwadiibasmi toptalwadiibasmi self-assigned this Jan 16, 2024
@toptalwadiibasmi toptalwadiibasmi changed the title [CPT-1480] Prevent Select from closing when it is multiple and search was clicked [CPT-1480] Prevent multiple Select from closing when search was clicked Jan 16, 2024
@toptalwadiibasmi
Copy link
Contributor Author

@toptal-anvil ping reviewers

@sashuk
Copy link
Contributor

sashuk commented Jan 17, 2024

@toptalwadiibasmi Thank you for contribution! Can you please double-check with @whymancreates if this is a correct behaviour for Select component in #-base-core? The change does seem logical, basically we have the same behavior for multiple options select independently if the search is activated

(from pull request checks) Make sure that additions and changes on the design follow Toptal's BASE design, and it's been already discussed with designers at #-base-core

@sashuk
Copy link
Contributor

sashuk commented Jan 17, 2024

@toptalwadiibasmi For example, it is not clear if we should leave the search term in input after clicking on one of the search results – right now the input is reset, not sure if this behavior is okay from point of view of Design Team

Recording from pull request temploy

Kapture.2024-01-17.at.11.11.35.mp4

@toptalwadiibasmi
Copy link
Contributor Author

@toptalwadiibasmi For example, it is not clear if we should leave the search term in input after clicking on one of the search results – right now the input is reset, not sure if this behavior is okay from point of view of Design Team

Recording from pull request temploy

Kapture.2024-01-17.at.11.11.35.mp4

@whymancreates What do you think of this behavior? The current implementation resets the search upon choosing an item. Should we retain the search term or keep it?

@rasitozcan
Copy link
Contributor

@sashuk & @toptalwadiibasmi, me and @whymancreates had chance to review the tickets in terms of BASE compatibility (when the ticket was first created). And we have agreed on they are acceptable.

@sashuk
Copy link
Contributor

sashuk commented Jan 17, 2024

Thank you @rasitozcan!

@toptalwadiibasmi Can you please finish the pull request description?

@whymancreates
Copy link

@toptalwadiibasmi For example, it is not clear if we should leave the search term in input after clicking on one of the search results – right now the input is reset, not sure if this behavior is okay from point of view of Design Team
Recording from pull request temploy
Kapture.2024-01-17.at.11.11.35.mp4

@whymancreates What do you think of this behavior? The current implementation resets the search upon choosing an item. Should we retain the search term or keep it?

In a multiselect I agree to retain the search term in the input box and keep the result list even after selection.

Copy link
Contributor

@sashuk sashuk left a comment

Choose a reason for hiding this comment

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

Code looks good, works as expected, tests were adjusted

Error in Jest tests https://github.com/toptal/picasso/actions/runs/7544801668/job/20538958946?pr=4101#step:15:328 should be easy to fix

@toptalwadiibasmi
Copy link
Contributor Author

@toptal-anvil ping reviewers

@toptalwadiibasmi
Copy link
Contributor Author

  • Search is no longer reset after selecting an option when the select is multiple.
  • I fixed the failing jest test.

@toptalwadiibasmi
Copy link
Contributor Author

Should I take any action to get the Happo's check successful?

@sashuk sashuk force-pushed the CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode branch from 8f1520f to faf4525 Compare January 18, 2024 16:15
@sashuk
Copy link
Contributor

sashuk commented Jan 18, 2024

@toptalwadiibasmi Visual test is not related, I've rebased the pull request to rerun the test

@toptalwadiibasmi toptalwadiibasmi force-pushed the CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode branch from faf4525 to abc9238 Compare January 18, 2024 23:41
@toptalwadiibasmi
Copy link
Contributor Author

@toptal-bot run package:alpha-release

@toptalwadiibasmi
Copy link
Contributor Author

I am unable to run the package:alpha-release due to the error in the check. Pard my ignorance as this is one of my first time having contribution, can someone help?

@sashuk
Copy link
Contributor

sashuk commented Jan 19, 2024

@toptal-bot run package:alpha-release

@toptal-devbot
Copy link
Collaborator

Your alpha package is ready 🎉
yarn add @topkit/analytics-charts@53.0.1-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.60+abc9238aa
yarn add @toptal/picasso@42.3.7-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.4+abc9238aa
yarn add @toptal/picasso-charts@56.0.3-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.4+abc9238aa
yarn add @toptal/picasso-codemod@5.6.4-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.110+abc9238aa
yarn add @toptal/picasso-forms@66.1.4-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.4+abc9238aa
yarn add @toptal/picasso-pictograms@2.0.1-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.180+abc9238aa
yarn add @toptal/picasso-provider@3.4.4-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.11+abc9238aa
yarn add @toptal/picasso-query-builder@1.4.2-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.13+abc9238aa
yarn add @toptal/picasso-rich-text-editor@10.0.1-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.60+abc9238aa
yarn add @toptal/picasso-shared@13.1.4-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.11+abc9238aa
yarn add @toptal/picasso-tailwind@1.0.2-alpha-CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode-abc9238aa.40+abc9238aa

@sashuk
Copy link
Contributor

sashuk commented Jan 19, 2024

@toptalwadiibasmi There was caching issue, packages are generated now 👍

@toptalwadiibasmi
Copy link
Contributor Author

Thanks @sashuk !

@toptalwadiibasmi toptalwadiibasmi force-pushed the CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode branch from abc9238 to b023176 Compare January 22, 2024 01:46
@toptalwadiibasmi
Copy link
Contributor Author

@toptal-anvil ping reviewers

@sashuk sashuk requested a review from a team January 22, 2024 11:04
@toptalwadiibasmi toptalwadiibasmi force-pushed the CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode branch from b023176 to 06050b1 Compare January 22, 2024 12:55
Co-authored-by: Rasit Ozcan <[email protected]>
@toptalwadiibasmi toptalwadiibasmi merged commit 9313243 into master Jan 23, 2024
17 of 18 checks passed
@toptalwadiibasmi toptalwadiibasmi deleted the CPT-1480-fe-keep-picasso-select-dropdown-open-when-a-selection-is-made-in-search-mode branch January 23, 2024 07:31
@toptal-build toptal-build mentioned this pull request Jan 23, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution DO NOT ADD MANUALLY
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants