adobe / adobe/react-spectrum

Dynamic submenus do not trigger when any submenu has been triggered

Open
#9,915 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

I have a dynamic submenu that displays when the user has the corresponding permission.

When the network is fast, the dynamic submenu appears before any user interactions, and the RAC functions well.

https://github.com/user-attachments/assets/397c0fdf-c8b9-4ca7-baab-da7dac7ee3af

However, in poor network conditions, the dynamic submenu appears after other submenus, and it will not be triggered.

https://github.com/user-attachments/assets/ecb139d9-39d3-4811-8490-5738fcbd6557

### 🤔 Expected Behavior?

the dynamic submenu displays

### 😯 Current Behavior

the dynamic submenu is not triggered

### 💁 Possible Solution

_No response_

### 🔦 Context

```tsx
import { useEffect, useState } from "react";
import {
Button,
Menu,
MenuItem,
MenuTrigger,
Popover,
SubmenuTrigger,
} from "react-aria-components";

export default function App() {
return (

Menu




Logout



);
}

function SubMenu({ label = "Submenu" }) {
return (

{label}


Option 1
Option 2



);
}

function AuthSubMenu() {
const [isAuthed, setIsAuthed] = useState(false);
useEffect(() => {
const timer = setTimeout(() => setIsAuthed(true), 1500);
return () => clearTimeout(timer);
}, []);

if (!isAuthed) return false;
return ;
}
```

### 🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/flamboyant-worker-9vqw3v?file=%2Fsrc%2FApp.js%3A33%2C22

### Version

react-aria-components@1.16.0

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

macOS

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.