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

Select and TypeaheadSelect improvements #227

Open
wants to merge 16 commits into
base: next-release
Choose a base branch
from

Conversation

gulcinuras
Copy link
Contributor

@gulcinuras gulcinuras commented Feb 20, 2023

  • After setting props.options as initial options value in selectOwnState, async options are not added in the options array. So, the async SelectItem has an index value of -1 which is equal to the focusedOptionIndex. That was why async items were highlighted unintentionally. -> resolves issue Select: Weird bug with options state #208
  • Create generic Id type for Option interface -> resolves issue Select: Type improvements #206

- Add title as an interface prop and set type as ReactNode
- Create an enum for Language options and use it in Select and TypeaheadSelect components
- Use contentRenderer as Select.Item content
- Use contentRenderer for tag content as we removed the title prop
- Instead of handling the keyword change inside TypeaheadSelect by filtering titles, handle it outside of the component
…d to set initial and changeable value

- Set canSelectMultiple to false if options.length is not bigger than 1
- Add testid to use in typeahead-select.test
- Add onClick optional prop to TypeheadSelectTrigger to set the correct classname when the menu is open
- setMenuVisibility to false if shouldCloseOnSelect is true, so that the classnames are correct
- Remove input styles when TypeaheadSelectInput is used inside of the trigger
- Add testid to TypeheadSelectTrigger to test it easily
- Fix most of the test cases for typeahead-select
        - Fix classnames
        - I used screen.findByText function to find the option but I can update it
Note:- In my opinion, having two classnames for typeahead-select and select is a bit unnecessary. We can just add typeahead-select as main classname and override select classnames if necessary.
- I couldn't fix a11y test case for the typeahead-select.
@github-actions
Copy link

github-actions bot commented Feb 20, 2023

PR Preview Action v1.4.7
🚀 Deployed preview to https://studiobakers.github.io/react-ui-toolkit/pr-preview/pr-227/
on branch gh-pages at 2024-05-15 15:51 UTC

@gulcinuras gulcinuras linked an issue Feb 20, 2023 that may be closed by this pull request
@edizcelik
Copy link
Contributor

I guess only the last two commits belongs to this PR

src/select/util/selectTypes.ts Outdated Show resolved Hide resolved
src/select/Select.tsx Outdated Show resolved Hide resolved
@gulcinuras gulcinuras requested review from edizcelik, jamcry, yasincaliskan and Anlerkan and removed request for edizcelik and ErenYLCN September 13, 2023 09:30
@Anlerkan Anlerkan removed the request for review from edizcelik September 13, 2023 10:08
@Anlerkan
Copy link
Contributor

Let's update the PR title

@gulcinuras gulcinuras changed the title fix(select/options): Set options to the state with dispatch if the length is not equal Remove the options field from selectOwnState Jan 17, 2024
@jamcry jamcry changed the base branch from next-release to fix/select March 26, 2024 11:27
@jamcry jamcry changed the base branch from fix/select to next-release March 26, 2024 11:27
jamcry and others added 2 commits March 26, 2024 13:32
…ce we are handling the keyword state on our projects

- controlledKeyword is the typeaheadProps.value with initial value
- Update typeahead-select.test
- Update stories
@gulcinuras gulcinuras changed the title Remove the options field from selectOwnState Select/TypeaheadSelect improvements Apr 2, 2024
@gulcinuras gulcinuras changed the title Select/TypeaheadSelect improvements Select/TypeaheadSelect improvements Apr 2, 2024
@gulcinuras gulcinuras changed the title Select/TypeaheadSelect improvements Select and TypeaheadSelect improvements Apr 2, 2024
@gulcinuras gulcinuras requested a review from Anlerkan April 3, 2024 10:22
Copy link
Collaborator

Choose a reason for hiding this comment

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

}: TypeheadSelectTriggerProps) {
return (
<Select.Trigger customClassName={"typeahead-select-trigger"}>
<Select.Trigger customClassName={"typeahead-select-trigger"} onClick={onClick}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's see why this was added and if it's necessary

@gulcinuras gulcinuras requested a review from jamcry May 15, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select: Weird bug with options state
4 participants