Skip to content

Commit 4c97678

Browse files
committed
fix(components): fix incorrect usage of useid
1 parent 28bb675 commit 4c97678

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

packages/compass-components/src/components/interactive-popover.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { palette } from '@leafygreen-ui/palette';
88
import { rgba } from 'polished';
99
import { useDarkMode } from '../hooks/use-theme';
1010
import { useHotkeys } from '../hooks/use-hotkeys';
11-
import { useId } from '@react-aria/utils';
1211

1312
const borderRadius = spacing[2];
1413

@@ -162,7 +161,7 @@ function InteractivePopover({
162161

163162
useHotkeys('Escape', onClose, { enabled: open }, [onClose]);
164163

165-
const closeButtonId = useId('close-button-id');
164+
const closeButtonId = 'close-button-id';
166165

167166
return trigger({
168167
onClick: onClickTrigger,

packages/compass-components/src/hooks/use-sort.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('use-sort', function () {
5757
expect(
5858
screen
5959
.getByRole('button', {
60-
name: /title/i,
60+
name: 'Sort by',
6161
})
6262
.getAttribute('aria-disabled')
6363
).to.equal('true');
@@ -70,7 +70,7 @@ describe('use-sort', function () {
7070
// Opens dropdown
7171
userEvent.click(
7272
screen.getByRole('button', {
73-
name: /title/i,
73+
name: 'Sort by',
7474
}),
7575
undefined,
7676
{
@@ -111,7 +111,7 @@ describe('use-sort', function () {
111111
// Opens dropdown
112112
userEvent.click(
113113
screen.getByRole('button', {
114-
name: /title/i,
114+
name: 'Sort by',
115115
}),
116116
undefined,
117117
{
@@ -141,7 +141,7 @@ describe('use-sort', function () {
141141
// Opens dropdown
142142
userEvent.click(
143143
screen.getByRole('button', {
144-
name: /title/i,
144+
name: 'Sort by',
145145
}),
146146
undefined,
147147
{

packages/compass-components/src/hooks/use-sort.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function useSortControls<T extends string>(
4343
items: readonly { name: T; label: string }[],
4444
options?: SortOptions
4545
): [React.ReactElement, SortState<Unwrap<typeof items>['name']>] {
46-
const labelId = useId('Sort by');
46+
const labelId = 'sort-by';
4747
const controlId = useId();
4848

4949
const [sortState, dispatch] = useReducer(

0 commit comments

Comments
 (0)