The PR adds a confirm step as a fixed inset-0 backdrop and a centered <div role="dialog">. The repo already has a Dialog (or Modal) primitive with a portal, focus trap, Escape to close, scroll lock, and a labelled title. The new overlay does not restore focus, does not close on Escape, and sits under the toast root or above the wrong z-index layer.

I’ve started treating a homemade overlay as incomplete when a Dialog primitive exists. The markup is the easy part. The focus and layering are why the primitive is there.

Why the homemade overlay shows up

A “modal” in a tutorial is a fixed div and a button. The model can write that without finding components/Dialog. Your primitive may be named Modal, Drawer, or a Radix/Headless UI wrapper, which is easy to miss if the prompt only says “add a confirm popup.”

You also skip things reviewers only catch later: initial focus on the primary action, return focus to the opener, aria-modal, and the existing reduced-motion path.

A simple Dialog policy

  • New modal, confirm, or drawer UI uses the existing primitive
  • Do not add a one-off fixed inset-0 overlay in a feature file
  • Titles and descriptions use the primitive’s labelled hooks, not a restyled empty div
  • A new variant (sheet, drawer, fullscreen) is a primitive change, with a story

If the design is a non-modal popover, use the existing popover/menu, not a dialog and not a new overlay.

What to put in the prompt

Use the existing Dialog (or Modal) primitive for this confirm step. Do not build a fixed backdrop + centered div in this file. Use the primitive’s title, close, and focus behavior. If you need a drawer or sheet variant, extend the primitive; do not invent a second overlay. 

Paste one existing Dialog usage. In review, search the diff for fixed inset-0, a raw role="dialog", and a backdrop that is not the primitive’s.

Reject / send back

Reject

  • A feature-level overlay that reimplements the Dialog
  • A dialog with no focus trap, no Escape path, or no labelled title
  • A second modal library added for one confirm
  • A z-index experiment that bypasses the primitive’s layer

Accept

  • A confirm or modal that uses the existing primitive
  • A primitive PR that adds a documented variant and a story
  • A non-modal popover built with the existing popover/menu