Skip to content
Discussion options

You must be logged in to vote

This is a common focus-management conflict when nesting menu -> dialog triggers.

DropdownMenu tries to restore focus to the trigger when it closes, while AlertDialog tries to move focus into the dialog at open. If both happen in the same tick, autofocus can look broken.

Typical fix pattern:

  1. In the menu item handler, preventDefault() and control dialog open state manually.
  2. Close the menu first, then open dialog on next microtask/tick (requestAnimationFrame/setTimeout(0)).
  3. Keep dialog trigger outside the dropdown content if possible (state-driven open is usually more predictable).

So instead of trigger-inside-item composition, wire it as:

  • menu item click -> set openDialog(true)
  • render Al…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@rafa-br34
Comment options

Answer selected by rafa-br34
Comment options

You must be logged in to vote
1 reply
@rafa-br34
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants