Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Require the agent to reuse the existing confirm dialog, not window.confirm

The PR deletes a row with window.confirm("Are you sure?") , or it mounts a new centered overlay with two buttons and a click-outside dismiss. The repo already has a ConfirmDialog (or AlertDialog ) with a title, a description, a destructive confirm action, and a focus return to the trigger. Nearby destructive actions already use it. The browser confirm cannot be styled, and the homemade overlay…

The existing confirm dialog, referred to as ConfirmDialog or AlertDialog, should be reused for any destructive or irreversible action within the application. The current implementation, which utilizes window.confirm, lacks the ability to style the dialog and fails to account for crucial features such as focus trapping, labeled actions, and a consistent danger style.

This oversight often leads to the creation of a new overlay with a generic "Are you sure?" message, which neglects to provide context about the impending action or its irreversible nature. In order to maintain consistency and usability, new destructive variants must be implemented as primitives, accompanied by a story that outlines their functionality.

It is essential to avoid calling window.confirm or window.alert, and to refrain from building a new overlay within a feature file. Instead, the existing title, description, and destructive confirm pattern of the ConfirmDialog or AlertDialog should be followed. If the action can be undone, it is preferable to use the existing undo Toast instead of creating a new confirm dialog.

This approach aligns with the overall user experience and ensures that destructive actions are handled in a consistent and intuitive manner across the application.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

More from Sunday, 29 November 2026 →