Escape inside a focused submenu closes the entire Dropdown instead of returning to its parent item

Ouverte
#274 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
67/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
react, typescript

Piste de recherche

Start with src/hooks/useAccessibility.ts and trace how Escape is handled when focus is inside a nested Menu submenu. Reproduce the reported sequence in Chrome: open the Dropdown, focus Submenu, open it with ArrowRight, then press Escape. Done means the submenu closes, focus returns to its parent menuitem, and the parent Dropdown stays open without calling onOpenChange(false).

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Reproduction
import Dropdown from '@rc-component/dropdown';
import Menu from '@rc-component/menu';

<Dropdown trigger={['click']} overlay={
  <Menu items={[{ key: 'sub', label: 'Submenu', children: [
    { key: 'child', label: 'Child' },
  ] }]} />
}>
  <button>Nested actions</button>
</Dropdown>
  1. Click the trigger.
  2. Press Tab to focus Submenu.
  3. Press ArrowRight to open the submenu and focus Child.
  4. Press Escape once.

Actual: both the submenu and parent Dropdown close, onOpenChange(false) runs, and focus goes to the Dropdown trigger.

Expected: close the submenu that contains focus and return focus to its parent menuitem; leave the parent Dropdown open. This follows the Escape behavior in the APG menu pattern.

Verification and scope

Reproduced with real Chrome key presses on macOS, using the source at PR #273 head b22af69306b82d60e64c6f513956564d019fe781 and again with only src/hooks/useAccessibility.ts restored from its base b4ea62f3293851934d64d9d92cbbd07d87a40dea. Both have this behavior, so this is an existing integration problem, not a regression introduced by #273. The single-level Escape focus fix in #273 works in the same native-browser comparison.

Dependencies: React/ReactDOM 19.3.1, menu 1.6.0, trigger 3.10.1, portal 2.2.1. Dependencies were installed in an isolated checkout from declared ranges (no upstream lockfile). An independent jsdom Dropdown/Menu integration test also observes the parent-close callback in both hook versions. No screen-reader conformance claim.

Checked open/closed submenu and Escape issue/PR searches here before filing. #38 concerns old menu-v6 layout; #272/#273 concern single-level Escape focus return. No duplicate source patch opened. AI-assisted reproduction and report; the described browser actions and tests were executed locally.

Langage dominant
TypeScript
Étoiles
181
Forks
112
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de react-component/dropdown

Toutes les issues de react-component/dropdown

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.