Skip to content

Commit 64d3135

Browse files
fix(clerk-js): SelectOption improvements (#6999)
1 parent 4d46e4e commit 64d3135

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

.changeset/forty-experts-battle.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Fixes an issue in SelectOption where the focus styles were not being properly applied when the option is focused.
6+
7+
Increases SelectOption touch area to remove any dead spots between items.

packages/clerk-js/src/ui/components/OrganizationProfile/MemberListTable.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
useLocalizations,
2121
} from '../../customizables';
2222
import { useLocalizeCustomRoles } from '../../hooks/useFetchRoles';
23-
import { common, type PropsOfComponent, type ThemableCssProp } from '../../styledSystem';
23+
import { type PropsOfComponent, type ThemableCssProp } from '../../styledSystem';
2424

2525
type MembersListTableProps = {
2626
headers: LocalizationKey[];
@@ -172,14 +172,6 @@ export const RoleSelect = (props: {
172172
<RolesListItem
173173
isSelected={isSelected}
174174
option={option}
175-
sx={theme => ({
176-
'&:hover': {
177-
background: common.mutedBackground(theme),
178-
},
179-
'&[data-focused="true"]': {
180-
background: common.mutedBackground(theme),
181-
},
182-
})}
183175
/>
184176
)}
185177
>

packages/clerk-js/src/ui/elements/Select.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Button, descriptors, Flex, Icon, Input, Text } from '../customizables';
77
import { usePopover, useSearchInput } from '../hooks';
88
import { ChevronDown } from '../icons';
99
import type { PropsOfComponent, ThemableCssProp } from '../styledSystem';
10-
import { animations } from '../styledSystem';
10+
import { animations, common } from '../styledSystem';
1111
import { colors } from '../utils/colors';
1212
import { withFloatingTree } from './contexts';
1313
import type { InputWithIcon } from './InputWithIcon';
@@ -51,17 +51,22 @@ type SelectState<O extends Option> = Pick<
5151

5252
const [SelectStateCtx, useSelectState] = createContextAndHook<SelectState<any>>('SelectState');
5353

54-
const defaultRenderOption = <O extends Option>(option: O, _index?: number, isFocused?: boolean) => {
54+
const defaultRenderOption = <O extends Option>(option: O, _index?: number) => {
5555
return (
5656
<Flex
5757
sx={theme => ({
58+
position: 'relative',
5859
width: '100%',
5960
padding: `${theme.space.$2} ${theme.space.$4}`,
6061
margin: `0 ${theme.space.$1}`,
6162
borderRadius: theme.radii.$md,
62-
...(isFocused && { backgroundColor: theme.colors.$neutralAlpha100 }),
63-
'&:hover': {
64-
backgroundColor: theme.colors.$neutralAlpha100,
63+
'&:hover, &[data-focused="true"]': {
64+
background: common.mutedBackground(theme),
65+
},
66+
'&::before': {
67+
content: '""',
68+
position: 'absolute',
69+
inset: `calc(${theme.space.$0x5} * -1) calc(${theme.space.$1} * -1)`,
6570
},
6671
})}
6772
>

packages/testing/src/playwright/unstable/page-objects/apiKeys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const createAPIKeysComponentPageObject = (testArgs: { page: EnhancedPage
4343
},
4444
selectExpiration: async (value?: keyof typeof expirationOptions) => {
4545
await page.getByRole('button', { name: /Select date/i }).click();
46-
return page.getByText(expirationOptions[value ?? 'never'], { exact: true }).click();
46+
return page.getByText(expirationOptions[value ?? 'never'], { exact: true }).click({ force: true });
4747
},
4848
clickSaveButton: () => {
4949
return page.getByText(/Create key/i).click();

0 commit comments

Comments
 (0)