diff --git a/eslint.config.mjs b/eslint.config.mjs index d7c27a8dbee..febc4cebfdd 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -457,6 +457,7 @@ export default [{ FileSystemDirectoryEntry: "readonly", FileSystemEntry: "readonly", IS_REACT_ACT_ENVIRONMENT: "readonly", + globalThis: "readonly", }, parser: tseslint.parser, diff --git a/packages/@react-aria/combobox/src/useComboBox.ts b/packages/@react-aria/combobox/src/useComboBox.ts index 9c4548ae47c..df4a19ce040 100644 --- a/packages/@react-aria/combobox/src/useComboBox.ts +++ b/packages/@react-aria/combobox/src/useComboBox.ts @@ -208,7 +208,7 @@ export function useComboBox(props: AriaCo state.setFocused(true); }; - let valueId = useValueId([state.selectedItems, state.selectionManager.selectionMode]); + let valueId = useValueId([state.selectionManager.selectedKeys, state.selectionManager.selectionMode]); let {isInvalid, validationErrors, validationDetails} = state.displayValidation; let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({ ...props, diff --git a/packages/@react-aria/combobox/test/useComboBox.test.js b/packages/@react-aria/combobox/test/useComboBox.test.js index 9b83283f355..2d2508a1848 100644 --- a/packages/@react-aria/combobox/test/useComboBox.test.js +++ b/packages/@react-aria/combobox/test/useComboBox.test.js @@ -52,6 +52,22 @@ describe('useComboBox', function () { jest.clearAllMocks(); }); + it('should not infinite loop when children is an inline function', function () { + let {result} = renderHook(() => { + let inlineProps = { + items: [{id: 'a', name: 'Option A'}, {id: 'b', name: 'Option B'}], + children: (item) => {item.name}, + placeholder: 'Select...', + allowsCustomValue: true, + menuTrigger: 'focus' + }; + let state = useComboBoxState(inlineProps); + return useComboBox({...inlineProps, ...props}, state); + }); + expect(result.current.inputProps).toBeDefined(); + expect(result.current.inputProps.role).toBe('combobox'); + }); + it('should return default props for all the button group elements', function () { let {result} = renderHook(() => useComboBox(props, useComboBoxState(defaultProps))); let {buttonProps, inputProps, listBoxProps, labelProps} = result.current; diff --git a/packages/@react-aria/interactions/src/usePress.ts b/packages/@react-aria/interactions/src/usePress.ts index 1ef7824fd61..46630ea9389 100644 --- a/packages/@react-aria/interactions/src/usePress.ts +++ b/packages/@react-aria/interactions/src/usePress.ts @@ -19,6 +19,7 @@ import { chain, focusWithoutScrolling, getEventTarget, + getNonce, getOwnerDocument, getOwnerWindow, isMac, @@ -887,6 +888,10 @@ export function usePress(props: PressHookProps): PressResult { const style = ownerDocument.createElement('style'); style.id = STYLE_ID; + let nonce = getNonce(ownerDocument); + if (nonce) { + style.nonce = nonce; + } // touchAction: 'manipulation' is supposed to be equivalent, but in // Safari it causes onPointerCancel not to fire on scroll. // https://bugs.webkit.org/show_bug.cgi?id=240917 diff --git a/packages/@react-aria/overlays/src/usePreventScroll.ts b/packages/@react-aria/overlays/src/usePreventScroll.ts index 81e2dff5162..d0cfe1d0c95 100644 --- a/packages/@react-aria/overlays/src/usePreventScroll.ts +++ b/packages/@react-aria/overlays/src/usePreventScroll.ts @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {chain, getActiveElement, getEventTarget, getScrollParent, isIOS, isScrollable, useLayoutEffect, willOpenKeyboard} from '@react-aria/utils'; +import {chain, getActiveElement, getEventTarget, getNonce, getScrollParent, isIOS, isScrollable, useLayoutEffect, willOpenKeyboard} from '@react-aria/utils'; interface PreventScrollOptions { /** Whether the scroll lock is disabled. */ @@ -134,6 +134,10 @@ function preventScrollMobileSafari() { // the window instead. // This must be applied before the touchstart event as of iOS 26, so inject it as a