@react-aria/menu
Advanced tools
Comparing version
@@ -26,3 +26,3 @@ var $815e346b11b84016$exports = require("./utils.main.js"); | ||
let { shouldFocusWrap: shouldFocusWrap = true, onKeyDown: onKeyDown, onKeyUp: onKeyUp, ...otherProps } = props; | ||
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.'); | ||
if (!props['aria-label'] && !props['aria-labelledby'] && process.env.NODE_ENV !== 'production') console.warn('An aria-label or aria-labelledby prop is required for accessibility.'); | ||
let domProps = (0, $6CumN$reactariautils.filterDOMProps)(props, { | ||
@@ -29,0 +29,0 @@ labelable: true |
@@ -20,3 +20,3 @@ import {menuData as $fc79756100351201$export$6f49b4016bfc8d56} from "./utils.module.js"; | ||
let { shouldFocusWrap: shouldFocusWrap = true, onKeyDown: onKeyDown, onKeyUp: onKeyUp, ...otherProps } = props; | ||
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.'); | ||
if (!props['aria-label'] && !props['aria-labelledby'] && process.env.NODE_ENV !== 'production') console.warn('An aria-label or aria-labelledby prop is required for accessibility.'); | ||
let domProps = (0, $ieN2F$filterDOMProps)(props, { | ||
@@ -23,0 +23,0 @@ labelable: true |
@@ -86,3 +86,7 @@ var $d1742ec2644a0949$exports = require("./intlStrings.main.js"); | ||
onPress (e) { | ||
if (e.pointerType === 'touch' && !isDisabled) state.toggle(); | ||
if (e.pointerType === 'touch' && !isDisabled) { | ||
// Ensure trigger has focus before opening the menu so it can be restored by FocusScope on close. | ||
(0, $jo7gW$reactariautils.focusWithoutScrolling)(e.target); | ||
state.toggle(); | ||
} | ||
} | ||
@@ -89,0 +93,0 @@ }; |
@@ -80,3 +80,7 @@ import $czs6v$intlStringsmodulejs from "./intlStrings.module.js"; | ||
onPress (e) { | ||
if (e.pointerType === 'touch' && !isDisabled) state.toggle(); | ||
if (e.pointerType === 'touch' && !isDisabled) { | ||
// Ensure trigger has focus before opening the menu so it can be restored by FocusScope on close. | ||
(0, $czs6v$focusWithoutScrolling)(e.target); | ||
state.toggle(); | ||
} | ||
} | ||
@@ -83,0 +87,0 @@ }; |
@@ -122,6 +122,8 @@ var $g3RPq$react = require("react"); | ||
window.addEventListener('pointermove', onPointerMove); | ||
window.addEventListener('pointerdown', onPointerDown, true); | ||
// Prevent pointer down over the safe triangle. See above comment. | ||
// Do not enable in tests, because JSDom doesn't do hit testing. | ||
if (process.env.NODE_ENV !== 'test') window.addEventListener('pointerdown', onPointerDown, true); | ||
return ()=>{ | ||
window.removeEventListener('pointermove', onPointerMove); | ||
window.removeEventListener('pointerdown', onPointerDown, true); | ||
if (process.env.NODE_ENV !== 'test') window.removeEventListener('pointerdown', onPointerDown, true); | ||
clearTimeout(timeout.current); | ||
@@ -128,0 +130,0 @@ clearTimeout(autoCloseTimeout.current); |
@@ -116,6 +116,8 @@ import {useRef as $fUfeP$useRef, useState as $fUfeP$useState, useEffect as $fUfeP$useEffect} from "react"; | ||
window.addEventListener('pointermove', onPointerMove); | ||
window.addEventListener('pointerdown', onPointerDown, true); | ||
// Prevent pointer down over the safe triangle. See above comment. | ||
// Do not enable in tests, because JSDom doesn't do hit testing. | ||
if (process.env.NODE_ENV !== 'test') window.addEventListener('pointerdown', onPointerDown, true); | ||
return ()=>{ | ||
window.removeEventListener('pointermove', onPointerMove); | ||
window.removeEventListener('pointerdown', onPointerDown, true); | ||
if (process.env.NODE_ENV !== 'test') window.removeEventListener('pointerdown', onPointerDown, true); | ||
clearTimeout(timeout.current); | ||
@@ -122,0 +124,0 @@ clearTimeout(autoCloseTimeout.current); |
var $62347d8c4183e713$exports = require("./useSafelyMouseToSubmenu.main.js"); | ||
var $23MMN$reactariautils = require("@react-aria/utils"); | ||
var $23MMN$reactariainteractions = require("@react-aria/interactions"); | ||
var $23MMN$react = require("react"); | ||
@@ -27,3 +26,2 @@ var $23MMN$reactariai18n = require("@react-aria/i18n"); | ||
function $5f4753043c9f6cdf$export$7138b0d059a6e743(props, state, ref) { | ||
@@ -59,2 +57,5 @@ let { parentMenuRef: parentMenuRef, submenuRef: submenuRef, type: type = 'menu', isDisabled: isDisabled, delay: delay = 200, shouldUseVirtualFocus: shouldUseVirtualFocus } = props; | ||
let submenuKeyDown = (e)=>{ | ||
// If focus is not within the menu, assume virtual focus is being used. | ||
// This means some other input element is also within the popover, so we shouldn't close the menu. | ||
if (!e.currentTarget.contains(document.activeElement)) return; | ||
switch(e.key){ | ||
@@ -174,6 +175,2 @@ case 'ArrowLeft': | ||
isNonModal: true, | ||
// We will manually coerce focus back to the triggers for mobile screen readers and non virtual focus use cases (aka submenus outside of autocomplete) so turn off | ||
// FocusScope then. For virtual focus use cases (Autocomplete subdialogs/menu) and subdialogs we want to keep FocusScope restoreFocus to automatically | ||
// send focus to parent subdialog input fields and/or tab containment | ||
disableFocusManagement: !shouldUseVirtualFocus && ((0, $23MMN$reactariainteractions.getInteractionModality)() === 'virtual' || type === 'menu'), | ||
shouldCloseOnInteractOutside: shouldCloseOnInteractOutside | ||
@@ -180,0 +177,0 @@ } |
import {useSafelyMouseToSubmenu as $d275435c250248f8$export$85ec83e04c95f50a} from "./useSafelyMouseToSubmenu.module.js"; | ||
import {useId as $dXlYe$useId, useEffectEvent as $dXlYe$useEffectEvent, useLayoutEffect as $dXlYe$useLayoutEffect, focusWithoutScrolling as $dXlYe$focusWithoutScrolling} from "@react-aria/utils"; | ||
import {getInteractionModality as $dXlYe$getInteractionModality} from "@react-aria/interactions"; | ||
import {useRef as $dXlYe$useRef, useCallback as $dXlYe$useCallback} from "react"; | ||
@@ -21,3 +20,2 @@ import {useLocale as $dXlYe$useLocale} from "@react-aria/i18n"; | ||
function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) { | ||
@@ -53,2 +51,5 @@ let { parentMenuRef: parentMenuRef, submenuRef: submenuRef, type: type = 'menu', isDisabled: isDisabled, delay: delay = 200, shouldUseVirtualFocus: shouldUseVirtualFocus } = props; | ||
let submenuKeyDown = (e)=>{ | ||
// If focus is not within the menu, assume virtual focus is being used. | ||
// This means some other input element is also within the popover, so we shouldn't close the menu. | ||
if (!e.currentTarget.contains(document.activeElement)) return; | ||
switch(e.key){ | ||
@@ -168,6 +169,2 @@ case 'ArrowLeft': | ||
isNonModal: true, | ||
// We will manually coerce focus back to the triggers for mobile screen readers and non virtual focus use cases (aka submenus outside of autocomplete) so turn off | ||
// FocusScope then. For virtual focus use cases (Autocomplete subdialogs/menu) and subdialogs we want to keep FocusScope restoreFocus to automatically | ||
// send focus to parent subdialog input fields and/or tab containment | ||
disableFocusManagement: !shouldUseVirtualFocus && ((0, $dXlYe$getInteractionModality)() === 'virtual' || type === 'menu'), | ||
shouldCloseOnInteractOutside: shouldCloseOnInteractOutside | ||
@@ -174,0 +171,0 @@ } |
{ | ||
"name": "@react-aria/menu", | ||
"version": "3.0.0-nightly-f90f4899f-250227", | ||
"version": "3.0.0-nightly-f9ea4ca39-250515", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,15 +25,15 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/focus": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-aria/i18n": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-aria/interactions": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-aria/overlays": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-aria/selection": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-aria/utils": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-stately/collections": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-stately/menu": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-stately/selection": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-stately/tree": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-types/button": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-types/menu": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-types/shared": "3.0.0-nightly-f90f4899f-250227", | ||
"@react-aria/focus": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-aria/i18n": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-aria/interactions": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-aria/overlays": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-aria/selection": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-aria/utils": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-stately/collections": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-stately/menu": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-stately/selection": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-stately/tree": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-types/button": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-types/menu": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@react-types/shared": "3.0.0-nightly-f9ea4ca39-250515", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -40,0 +40,0 @@ }, |
@@ -53,3 +53,3 @@ /* | ||
if (!props['aria-label'] && !props['aria-labelledby']) { | ||
if (!props['aria-label'] && !props['aria-labelledby'] && process.env.NODE_ENV !== 'production') { | ||
console.warn('An aria-label or aria-labelledby prop is required for accessibility.'); | ||
@@ -56,0 +56,0 @@ } |
@@ -126,2 +126,5 @@ /* | ||
if (e.pointerType === 'touch' && !isDisabled) { | ||
// Ensure trigger has focus before opening the menu so it can be restored by FocusScope on close. | ||
focusWithoutScrolling(e.target as FocusableElement); | ||
state.toggle(); | ||
@@ -128,0 +131,0 @@ } |
@@ -27,3 +27,3 @@ | ||
*/ | ||
export function useSafelyMouseToSubmenu(options: SafelyMouseToSubmenuOptions) { | ||
export function useSafelyMouseToSubmenu(options: SafelyMouseToSubmenuOptions): void { | ||
let {menuRef, submenuRef, isOpen, isDisabled} = options; | ||
@@ -30,0 +30,0 @@ let prevPointerPos = useRef<{x: number, y: number} | undefined>(undefined); |
@@ -18,3 +18,2 @@ /* | ||
import {focusWithoutScrolling, useEffectEvent, useId, useLayoutEffect} from '@react-aria/utils'; | ||
import {getInteractionModality} from '@react-aria/interactions'; | ||
import type {SubmenuTriggerState} from '@react-stately/menu'; | ||
@@ -103,2 +102,8 @@ import {useCallback, useRef} from 'react'; | ||
let submenuKeyDown = (e: KeyboardEvent) => { | ||
// If focus is not within the menu, assume virtual focus is being used. | ||
// This means some other input element is also within the popover, so we shouldn't close the menu. | ||
if (!e.currentTarget.contains(document.activeElement)) { | ||
return; | ||
} | ||
switch (e.key) { | ||
@@ -255,6 +260,2 @@ case 'ArrowLeft': | ||
isNonModal: true, | ||
// We will manually coerce focus back to the triggers for mobile screen readers and non virtual focus use cases (aka submenus outside of autocomplete) so turn off | ||
// FocusScope then. For virtual focus use cases (Autocomplete subdialogs/menu) and subdialogs we want to keep FocusScope restoreFocus to automatically | ||
// send focus to parent subdialog input fields and/or tab containment | ||
disableFocusManagement: !shouldUseVirtualFocus && (getInteractionModality() === 'virtual' || type === 'menu'), | ||
shouldCloseOnInteractOutside | ||
@@ -261,0 +262,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
341094
0.07%4120
0.34%9
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated