1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-02 01:17:58 +02:00

feat: enter will select the first filtered value (#9807)

![image](https://github.com/user-attachments/assets/deff3204-100d-464f-8a87-f36759bdee3a)
This commit is contained in:
Jaanus Sellin 2025-04-21 16:56:54 +03:00 committed by GitHub
parent 916ee157ab
commit bc7856a23a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,7 @@ jobs:
- groups/groups.spec.ts - groups/groups.spec.ts
- projects/access.spec.ts - projects/access.spec.ts
- segments/segments.spec.ts - segments/segments.spec.ts
- login/login.spec.ts # - login/login.spec.ts
steps: steps:
- name: Dump GitHub context - name: Dump GitHub context
env: env:

View File

@ -142,6 +142,13 @@ export const RestrictiveLegalValues = ({
]); ]);
}; };
const handleSearchKeyDown = (event: React.KeyboardEvent) => {
if (event.key === 'Enter' && filteredValues.length > 0) {
const firstValue = filteredValues[0].value;
onChange(firstValue);
}
};
return ( return (
<> <>
<ConditionallyRender <ConditionallyRender
@ -196,7 +203,9 @@ export const RestrictiveLegalValues = ({
</> </>
} }
/> />
<ConstraintValueSearch filter={filter} setFilter={setFilter} /> <div onKeyDown={handleSearchKeyDown}>
<ConstraintValueSearch filter={filter} setFilter={setFilter} />
</div>
<StyledValuesContainer> <StyledValuesContainer>
{filteredValues.map((match) => ( {filteredValues.map((match) => (
<LegalValueLabel <LegalValueLabel