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

fix: preload options to lookup field #523

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

gosiexon-zen
Copy link
Contributor

Description

Jira issue
When the combobox is focused and the input text is empty, the user will see a list of options retrieved from the Autocomplete API. The list is limited to 100 options maximum. The selected option is shown as the second option on the list after empty option.
The search icon is removed from the field.

Screenshots

Screenshot 2024-09-16 at 17 27 29

Checklist

  • 📗 all commit messages follow the conventional commits standard
  • ⬅️ changes are compatible with RTL direction
  • ♿ Changes to the UI are tested for accessibility and compliant with WCAG 2.1.
  • 📝 changes are tested in Chrome, Firefox, Safari and Edge
  • 📱 changes are responsive and tested in mobile
  • 👍 PR is approved by @zendesk/vikings

@gosiexon-zen gosiexon-zen self-assigned this Sep 16, 2024
@gosiexon-zen gosiexon-zen requested a review from a team as a code owner September 16, 2024 15:28
fetchedOptions = fetchedOptions.filter(
(option: FieldOption) => option.value !== selectedOption.value
);
fetchedOptions = [selectedOption, ...fetchedOptions];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to guarantee that the selected option appears at the top?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so 😬 just manually setting the order

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the preferred experience for when an option is already selected?
I was going through the JIRA ticket and the slack thread but couldn't see it mentioned there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the same experience as in Lookup Field in Support and we want to make this fields almost the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it! 👍🏼

Copy link
Contributor

@luis-almeida luis-almeida left a comment

Choose a reason for hiding this comment

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

I tested the branch and it looks good! I agree this is a much better experience 👍🏼
Caching the api responses could reduce the amount of calls needed but we can always add that later on if needed.

@gosiexon-zen gosiexon-zen merged commit 75aeb23 into lookup-fields Sep 17, 2024
5 checks passed
@gosiexon-zen gosiexon-zen deleted the mbien/lookup-field-initial-options branch September 17, 2024 10:51
@zd-svc-github-copenhagen-theme
Copy link
Collaborator

🎉 This PR is included in version 4.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants