Skip to content

Commit 593cdca

Browse files
authored
Merge branch 'main' into audit-fixes
2 parents 273cd14 + 6e76c3c commit 593cdca

File tree

220 files changed

+945
-915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+945
-915
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/lib/ReactStaticPackager.js b/lib/ReactStaticPackager.js
2+
index 551b6071819ea7c8c28106281793841d63791856..00ee58c81302cf433ad27a8a8ce2c2d1be5ce716 100644
3+
--- a/lib/ReactStaticPackager.js
4+
+++ b/lib/ReactStaticPackager.js
5+
@@ -597,7 +597,7 @@ function runModule(code, filename, id, require, parcelRequire) {
6+
return module.exports;
7+
}
8+
function getCacheKey(asset) {
9+
- return asset.filePath + '#' + asset.env.context + (asset.uniqueKey ? '-' + asset.uniqueKey : '');
10+
+ return (asset.pipeline ? asset.pipeline : '') + asset.filePath + '#' + asset.env.context + (asset.uniqueKey ? '-' + asset.uniqueKey : '');
11+
}
12+
function getSpecifier(dep) {
13+
if (typeof dep.meta.placeholder === 'string') {

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"@parcel/core": "^2.16.1",
9696
"@parcel/optimizer-data-url": "^2.16.1",
9797
"@parcel/optimizer-terser": "^2.16.1",
98-
"@parcel/packager-react-static": "^2.16.1",
98+
"@parcel/packager-react-static": "patch:@parcel/packager-react-static@npm%3A2.16.1#~/.yarn/patches/@parcel-packager-react-static-npm-2.16.1-138e4b8f05.patch",
9999
"@parcel/packager-ts": "^2.16.1",
100100
"@parcel/reporter-bundle-analyzer": "^2.16.1",
101101
"@parcel/reporter-cli": "^2.16.1",
@@ -232,7 +232,8 @@
232232
"remark-parse": "patch:remark-parse@npm%3A10.0.1#~/.yarn/patches/remark-parse-npm-10.0.1-e654d7df78.patch",
233233
"lightningcss": "1.30.1",
234234
"react-server-dom-parcel": "canary",
235-
"react-test-renderer": "19.1.0"
235+
"react-test-renderer": "19.1.0",
236+
"@parcel/packager-react-static": "patch:@parcel/packager-react-static@npm%3A2.16.1#~/.yarn/patches/@parcel-packager-react-static-npm-2.16.1-138e4b8f05.patch"
236237
},
237238
"@parcel/transformer-css": {
238239
"cssModules": {

packages/@react-aria/autocomplete/src/useAutocomplete.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {AriaTextFieldProps} from '@react-aria/textfield';
1515
import {AutocompleteProps, AutocompleteState} from '@react-stately/autocomplete';
1616
import {CLEAR_FOCUS_EVENT, FOCUS_EVENT, getActiveElement, getOwnerDocument, isAndroid, isCtrlKeyPressed, isIOS, mergeProps, mergeRefs, useEffectEvent, useEvent, useId, useLabels, useLayoutEffect, useObjectRef} from '@react-aria/utils';
1717
import {dispatchVirtualBlur, dispatchVirtualFocus, getVirtuallyFocusedElement, moveVirtualFocus} from '@react-aria/focus';
18-
import {getInteractionModality} from '@react-aria/interactions';
18+
import {getInteractionModality, getPointerType} from '@react-aria/interactions';
1919
// @ts-ignore
2020
import intlMessages from '../intl/*.json';
2121
import {FocusEvent as ReactFocusEvent, KeyboardEvent as ReactKeyboardEvent, useCallback, useEffect, useMemo, useRef, useState} from 'react';
@@ -92,7 +92,6 @@ export function useAutocomplete<T>(props: AriaAutocompleteOptions<T>, state: Aut
9292
let timeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
9393
let delayNextActiveDescendant = useRef(false);
9494
let queuedActiveDescendant = useRef<string | null>(null);
95-
let lastPointerType = useRef<string | null>(null);
9695

9796
// For mobile screen readers, we don't want virtual focus, instead opting to disable FocusScope's restoreFocus and manually
9897
// moving focus back to the subtriggers
@@ -106,23 +105,10 @@ export function useAutocomplete<T>(props: AriaAutocompleteOptions<T>, state: Aut
106105
return () => clearTimeout(timeout.current);
107106
}, []);
108107

109-
useEffect(() => {
110-
let handlePointerDown = (e: PointerEvent) => {
111-
lastPointerType.current = e.pointerType;
112-
};
113-
114-
if (typeof PointerEvent !== 'undefined') {
115-
document.addEventListener('pointerdown', handlePointerDown, true);
116-
return () => {
117-
document.removeEventListener('pointerdown', handlePointerDown, true);
118-
};
119-
}
120-
}, []);
121-
122108
let updateActiveDescendantEvent = useEffectEvent((e: Event) => {
123109
// Ensure input is focused if the user clicks on the collection directly.
124110
// don't trigger on touch so that mobile keyboard doesnt appear when tapping on options
125-
if (!e.isTrusted && shouldUseVirtualFocus && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) !== inputRef.current && lastPointerType.current !== 'touch') {
111+
if (!e.isTrusted && shouldUseVirtualFocus && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) !== inputRef.current && getPointerType() !== 'touch') {
126112
inputRef.current.focus();
127113
}
128114

packages/@react-aria/button/docs/useToggleButtonGroup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ By default, toggle button groups are horizontally oriented. The orientation prop
252252
</ToggleButtonGroup>
253253
```
254254

255-
## Accessiblity
255+
## Accessibility
256256

257257
A `ToggleButtonGroup` can be labeled using the `aria-label` or `aria-labelledby` props.
258258

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export {
1717
isFocusVisible,
1818
getInteractionModality,
1919
setInteractionModality,
20+
getPointerType,
2021
addWindowFocusTracking,
2122
useInteractionModality,
2223
useFocusVisible,

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import {getOwnerDocument, getOwnerWindow, isMac, isVirtualClick, openLink} from '@react-aria/utils';
1919
import {ignoreFocusEvent} from './utils';
20+
import {PointerType} from '@react-types/shared';
2021
import {useEffect, useState} from 'react';
2122
import {useIsSSR} from '@react-aria/ssr';
2223

@@ -37,6 +38,7 @@ export interface FocusVisibleResult {
3738
}
3839

3940
let currentModality: null | Modality = null;
41+
let currentPointerType: PointerType = 'keyboard';
4042
let changeHandlers = new Set<Handler>();
4143
interface GlobalListenerData {
4244
focus: () => void
@@ -70,12 +72,14 @@ function handleKeyboardEvent(e: KeyboardEvent) {
7072
hasEventBeforeFocus = true;
7173
if (!(openLink as any).isOpening && isValidKey(e)) {
7274
currentModality = 'keyboard';
75+
currentPointerType = 'keyboard';
7376
triggerChangeHandlers('keyboard', e);
7477
}
7578
}
7679

7780
function handlePointerEvent(e: PointerEvent | MouseEvent) {
7881
currentModality = 'pointer';
82+
currentPointerType = 'pointerType' in e ? e.pointerType as PointerType : 'mouse';
7983
if (e.type === 'mousedown' || e.type === 'pointerdown') {
8084
hasEventBeforeFocus = true;
8185
triggerChangeHandlers('pointer', e);
@@ -86,6 +90,7 @@ function handleClickEvent(e: MouseEvent) {
8690
if (!(openLink as any).isOpening && isVirtualClick(e)) {
8791
hasEventBeforeFocus = true;
8892
currentModality = 'virtual';
93+
currentPointerType = 'virtual';
8994
}
9095
}
9196

@@ -101,6 +106,7 @@ function handleFocusEvent(e: FocusEvent) {
101106
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
102107
if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {
103108
currentModality = 'virtual';
109+
currentPointerType = 'virtual';
104110
triggerChangeHandlers('virtual', e);
105111
}
106112

@@ -249,9 +255,15 @@ export function getInteractionModality(): Modality | null {
249255

250256
export function setInteractionModality(modality: Modality): void {
251257
currentModality = modality;
258+
currentPointerType = modality === 'pointer' ? 'mouse' : modality;
252259
triggerChangeHandlers(modality, null);
253260
}
254261

262+
/** @private */
263+
export function getPointerType(): PointerType {
264+
return currentPointerType;
265+
}
266+
255267
/**
256268
* Keeps state of the current modality.
257269
*/

packages/@react-aria/overlays/docs/usePopover.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ with <TypeLink links={dialogDocs.links} type={dialogDocs.exports.useDialog} />.
7878

7979
The `Popover` component uses an &lt;<TypeLink links={docs.links} type={docs.exports.Overlay} />&gt; to render its contents in a React [Portal](https://reactjs.org/docs/portals.html) at the end of the document body, which ensures it is not clipped by other elements. It also acts as a focus scope, containing focus within the popover and restoring it to the trigger when it unmounts. <TypeLink links={docs.links} type={docs.exports.usePopover} /> handles positioning the popover relative to the trigger element, and closing it when the user interacts outside or presses the <Keyboard>Escape</Keyboard> key.
8080

81-
<TypeLink links={docs.links} type={docs.exports.usePopover} /> also hides content outside the popover from screen readers, which is important since the surrounding content won't be in context of the original trigger due to the portal. To allow screen reader users to dismiss the popover without a keyboard (e.g. on mobile), visually hidden &lt;<TypeLink links={docs.links} type={docs.exports.DismissButton} />&gt; elements are added at the start and end of the popover. An underlay is also used to prevent scrolling and interacting with elements outside the popover with a pointer, to avoid unintentially repositioning or closing it.
81+
<TypeLink links={docs.links} type={docs.exports.usePopover} /> also hides content outside the popover from screen readers, which is important since the surrounding content won't be in context of the original trigger due to the portal. To allow screen reader users to dismiss the popover without a keyboard (e.g. on mobile), visually hidden &lt;<TypeLink links={docs.links} type={docs.exports.DismissButton} />&gt; elements are added at the start and end of the popover. An underlay is also used to prevent scrolling and interacting with elements outside the popover with a pointer, to avoid unintentionally repositioning or closing it.
8282

8383
```tsx example export=true render=false
8484
import type {AriaPopoverProps} from 'react-aria';

packages/@react-aria/test-utils/src/testSetup.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,37 @@ export function installMouseEvent(): void {
3535
});
3636
}
3737

38+
export function definePointerEvent(): void {
39+
// @ts-ignore
40+
global.PointerEvent = class FakePointerEvent extends MouseEvent {
41+
_init: {pageX: number, pageY: number, pointerType: string, pointerId: number, width: number, height: number};
42+
constructor(name, init) {
43+
super(name, init);
44+
this._init = init;
45+
}
46+
get pointerType() {
47+
return this._init.pointerType ?? 'mouse';
48+
}
49+
get pointerId() {
50+
return this._init.pointerId;
51+
}
52+
get pageX() {
53+
return this._init.pageX;
54+
}
55+
get pageY() {
56+
return this._init.pageY;
57+
}
58+
get width() {
59+
return this._init.width;
60+
}
61+
get height() {
62+
return this._init.height;
63+
}
64+
};
65+
}
66+
3867
export function installPointerEvent(): void {
39-
beforeAll(() => {
40-
// @ts-ignore
41-
global.PointerEvent = class FakePointerEvent extends MouseEvent {
42-
_init: {pageX: number, pageY: number, pointerType: string, pointerId: number, width: number, height: number};
43-
constructor(name, init) {
44-
super(name, init);
45-
this._init = init;
46-
}
47-
get pointerType() {
48-
return this._init.pointerType ?? 'mouse';
49-
}
50-
get pointerId() {
51-
return this._init.pointerId;
52-
}
53-
get pageX() {
54-
return this._init.pageX;
55-
}
56-
get pageY() {
57-
return this._init.pageY;
58-
}
59-
get width() {
60-
return this._init.width;
61-
}
62-
get height() {
63-
return this._init.height;
64-
}
65-
};
66-
});
68+
beforeAll(definePointerEvent);
6769
afterAll(() => {
6870
// @ts-ignore
6971
delete global.PointerEvent;

packages/@react-aria/utils/src/mergeProps.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
2828

2929
/**
3030
* Merges multiple props objects together. Event handlers are chained,
31-
* classNames are combined, and ids are deduplicated - different ids
32-
* will trigger a side-effect and re-render components hooked up with `useId`.
31+
* classNames are combined, and ids are deduplicated.
3332
* For all other props, the last prop object overrides all previous ones.
3433
* @param args - Multiple sets of props to merge together.
3534
*/

packages/@react-spectrum/autocomplete/docs/SearchAutocomplete.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ See Icon's [labeling](workflow-icons.html#labeling) section and Avatar's [access
234234
<Item textValue="Mail">
235235
<Email size="S" />
236236
<Text>Mail</Text>
237-
<Text slot="description">Send and recieve emails</Text>
237+
<Text slot="description">Send and receive emails</Text>
238238
</Item>
239239
<Item textValue="File Explorer">
240240
<Folder size="S" />

0 commit comments

Comments
 (0)