Skip to content

Commit 1680885

Browse files
committed
review comments
1 parent 32c3792 commit 1680885

File tree

9 files changed

+30
-41
lines changed

9 files changed

+30
-41
lines changed

packages/@react-aria/interactions/src/usePress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ export function usePress(props: PressHookProps): PressResult {
372372
if (isDisabled) {
373373
e.preventDefault();
374374
}
375-
375+
376376
// If triggered from a screen reader or by using element.click(),
377377
// trigger as if it were a keyboard click.
378378
if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === 'virtual' || isVirtualClick(e.nativeEvent))) {
@@ -820,7 +820,7 @@ export function usePress(props: PressHookProps): PressResult {
820820
// Only apply touch-action if not already set by another CSS rule.
821821
let style = getOwnerWindow(element).getComputedStyle(element);
822822
if (style.touchAction === 'auto') {
823-
// touchAction: 'manipulation' is supposed to be equivalent, but in
823+
// touchAction: 'manipulation' is supposed to be equivalent, but in
824824
// Safari it causes onPointerCancel not to fire on scroll.
825825
// https://bugs.webkit.org/show_bug.cgi?id=240917
826826
(element as HTMLElement).style.touchAction = 'pan-x pan-y pinch-zoom';

packages/@react-spectrum/s2/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"devDependencies": {
123123
"@adobe/spectrum-tokens": "^13.0.0-beta.56",
124124
"@parcel/macros": "^2.14.0",
125-
"@react-aria/test-utils": "^1.0.0-alpha.6",
125+
"@react-aria/test-utils": "1.0.0-alpha.6",
126126
"@storybook/jest": "^0.2.3",
127127
"@testing-library/dom": "^10.1.0",
128128
"@testing-library/react": "^16.0.0",
@@ -154,8 +154,7 @@
154154
"react-stately": "^3.37.0"
155155
},
156156
"peerDependencies": {
157-
"react": "^18.0.0 || ^19.0.0-rc.1",
158-
"react-dom": "^18.0.0 || ^19.0.0-rc.1"
157+
"react": "^18.0.0 || ^19.0.0-rc.1"
159158
},
160159
"publishConfig": {
161160
"access": "public"

packages/@react-stately/select/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"url": "https://github.com/adobe/react-spectrum"
2323
},
2424
"dependencies": {
25-
"@react-aria/utils": "^3.28.2",
2625
"@react-stately/form": "^3.1.3",
2726
"@react-stately/list": "^3.12.1",
2827
"@react-stately/overlays": "^3.6.15",
@@ -31,8 +30,7 @@
3130
"@swc/helpers": "^0.5.0"
3231
},
3332
"peerDependencies": {
34-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
35-
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
33+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
3634
},
3735
"publishConfig": {
3836
"access": "public"

packages/@react-stately/select/src/useSelectState.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {FormValidationState, useFormValidationState} from '@react-stately/form';
1515
import {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';
1616
import {SelectProps} from '@react-types/select';
1717
import {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';
18-
import {useEffectEvent} from '@react-aria/utils';
1918
import {useMemo, useState} from 'react';
2019

2120
export interface SelectStateOptions<T> extends Omit<SelectProps<T>, 'children'>, CollectionStateBase<T> {}
@@ -64,27 +63,25 @@ export function useSelectState<T extends object>(props: SelectStateOptions<T>):
6463

6564
let [isFocused, setFocused] = useState(false);
6665
let isEmpty = useMemo(() => listState.collection.size === 0 || (listState.collection.size === 1 && listState.collection.getItem(listState.collection.getFirstKey()!)?.type === 'loader'), [listState.collection]);
67-
let open = useEffectEvent((focusStrategy: FocusStrategy | null = null) => {
68-
if (!isEmpty) {
69-
setFocusStrategy(focusStrategy);
70-
triggerState.open();
71-
}
72-
});
73-
74-
let toggle = useEffectEvent((focusStrategy: FocusStrategy | null = null) => {
75-
if (!isEmpty) {
76-
setFocusStrategy(focusStrategy);
77-
triggerState.toggle();
78-
}
79-
});
8066

8167
return {
8268
...validationState,
8369
...listState,
8470
...triggerState,
8571
focusStrategy,
86-
open,
87-
toggle,
72+
open(focusStrategy: FocusStrategy | null = null) {
73+
// Don't open if the collection is empty.
74+
if (!isEmpty) {
75+
setFocusStrategy(focusStrategy);
76+
triggerState.open();
77+
}
78+
},
79+
toggle(focusStrategy: FocusStrategy | null = null) {
80+
if (!isEmpty) {
81+
setFocusStrategy(focusStrategy);
82+
triggerState.toggle();
83+
}
84+
},
8885
isFocused,
8986
setFocused
9087
};

packages/react-aria-components/src/GridList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,11 @@ export const UNSTABLE_GridListLoadingSentinel = createLeafComponent('loader', fu
539539
</div>
540540
{isLoading && renderProps.children && (
541541
<div
542+
{...renderProps}
543+
{...mergeProps(filterDOMProps(props as any))}
542544
role="row"
543545
aria-rowindex={isVirtualized ? item.index + 1 : undefined}
544-
ref={ref}
545-
{...mergeProps(filterDOMProps(props as any))}
546-
{...renderProps}>
546+
ref={ref}>
547547
<div
548548
aria-colindex={isVirtualized ? 1 : undefined}
549549
role="gridcell">

packages/react-aria-components/src/ListBox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,12 @@ export const UNSTABLE_ListBoxLoadingSentinel = createLeafComponent('loader', fun
516516
</div>
517517
{isLoading && renderProps.children && (
518518
<div
519+
{...mergeProps(filterDOMProps(props as any), optionProps)}
520+
{...renderProps}
519521
// aria-selected isn't needed here since this option is not selectable.
520522
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
521523
role="option"
522-
ref={ref}
523-
{...mergeProps(filterDOMProps(props as any), optionProps)}
524-
{...renderProps}>
524+
ref={ref}>
525525
{renderProps.children}
526526
</div>
527527
)}

packages/react-aria-components/src/Table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,10 +1405,10 @@ export const UNSTABLE_TableLoadingSentinel = createLeafComponent('loader', funct
14051405
</TR>
14061406
{isLoading && renderProps.children && (
14071407
<TR
1408-
role="row"
1409-
ref={ref}
14101408
{...mergeProps(filterDOMProps(props as any), rowProps)}
1411-
{...renderProps}>
1409+
{...renderProps}
1410+
role="row"
1411+
ref={ref}>
14121412
<TD role="rowheader" {...rowHeaderProps} style={style}>
14131413
{renderProps.children}
14141414
</TD>

packages/react-stately/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
"@react-types/shared": "^3.29.0"
5353
},
5454
"peerDependencies": {
55-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
56-
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
55+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
5756
},
5857
"devDependencies": {
5958
"@babel/cli": "^7.24.1",

yarn.lock

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6742,7 +6742,7 @@ __metadata:
67426742
languageName: unknown
67436743
linkType: soft
67446744

6745-
"@react-aria/test-utils@npm:1.0.0-alpha.6, @react-aria/test-utils@npm:^1.0.0-alpha.6, @react-aria/test-utils@workspace:packages/@react-aria/test-utils":
6745+
"@react-aria/test-utils@npm:1.0.0-alpha.6, @react-aria/test-utils@workspace:packages/@react-aria/test-utils":
67466746
version: 0.0.0-use.local
67476747
resolution: "@react-aria/test-utils@workspace:packages/@react-aria/test-utils"
67486748
dependencies:
@@ -7962,7 +7962,7 @@ __metadata:
79627962
"@react-aria/interactions": "npm:^3.25.0"
79637963
"@react-aria/live-announcer": "npm:^3.4.2"
79647964
"@react-aria/overlays": "npm:^3.27.0"
7965-
"@react-aria/test-utils": "npm:^1.0.0-alpha.6"
7965+
"@react-aria/test-utils": "npm:1.0.0-alpha.6"
79667966
"@react-aria/utils": "npm:^3.28.2"
79677967
"@react-spectrum/utils": "npm:^3.12.4"
79687968
"@react-stately/layout": "npm:^4.2.2"
@@ -7985,7 +7985,6 @@ __metadata:
79857985
react-stately: "npm:^3.37.0"
79867986
peerDependencies:
79877987
react: ^18.0.0 || ^19.0.0-rc.1
7988-
react-dom: ^18.0.0 || ^19.0.0-rc.1
79897988
languageName: unknown
79907989
linkType: soft
79917990

@@ -8763,7 +8762,6 @@ __metadata:
87638762
version: 0.0.0-use.local
87648763
resolution: "@react-stately/select@workspace:packages/@react-stately/select"
87658764
dependencies:
8766-
"@react-aria/utils": "npm:^3.28.2"
87678765
"@react-stately/form": "npm:^3.1.3"
87688766
"@react-stately/list": "npm:^3.12.1"
87698767
"@react-stately/overlays": "npm:^3.6.15"
@@ -8772,7 +8770,6 @@ __metadata:
87728770
"@swc/helpers": "npm:^0.5.0"
87738771
peerDependencies:
87748772
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
8775-
react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
87768773
languageName: unknown
87778774
linkType: soft
87788775

@@ -27895,7 +27892,6 @@ __metadata:
2789527892
"@react-types/shared": "npm:^3.29.0"
2789627893
peerDependencies:
2789727894
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
27898-
react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
2789927895
languageName: unknown
2790027896
linkType: soft
2790127897

0 commit comments

Comments
 (0)