Skip to content

fix(ui): red OK button on destructive confirm popovers (#314) - #814

Open
skearnes wants to merge 1 commit into
mainfrom
fix/314-destructive-confirm-popover
Open

fix(ui): red OK button on destructive confirm popovers (#314)#814
skearnes wants to merge 1 commit into
mainfrom
fix/314-destructive-confirm-popover

Conversation

@skearnes

@skearnes skearnes commented Jun 23, 2026

Copy link
Copy Markdown
Member

Closes #314.

The destructive Remove buttons already turn red on hover (#776); this makes the confirmation popover match. Adds an optional destructive prop to ConfirmPopover that renders the OK button in red, applied to the remove/delete/unshare confirmations:

  • RemoveReaction, ReactionEntityDelete (reaction + entity remove)
  • DatasetHeader (remove dataset)
  • ShareDatasetSidebar (unshare dataset from a group)

Non-destructive confirmations (enumeration cancel, role change, share) are unchanged. Added unit tests asserting the OK button is red with destructive and default without. tsc -b + lint + affected component tests green.

🤖 Generated with Claude Code

Greptile Summary

Adds an optional destructive boolean prop to ConfirmPopover that renders the OK button in red (color="red") for irreversible actions, and applies it to all four remove/delete/unshare call-sites. Non-destructive confirmations are untouched.

  • ConfirmPopover receives destructive? in its props interface, destructures it before ...rest, and passes color={destructive ? 'red' : undefined} to the Mantine Button — clean and minimal.
  • Two new unit tests cover the red and non-red cases; they rely on Mantine serialising the colour as inline CSS custom properties containing "red", which works today but could drift with a Mantine version bump.
  • All four destructive call-sites (DatasetHeader, ShareDatasetSidebar, ReactionEntityDelete, RemoveReaction) are updated consistently.

Confidence Score: 5/5

Safe to merge — the change is a small additive UI prop with no logic or data-flow implications.

All four destructive call-sites are updated consistently, the new prop is fully optional so existing non-destructive uses need no changes, and the implementation is a single ternary. The only note is that the new tests sniff a raw style-attribute string, which could drift with a Mantine upgrade, but that is a test-maintenance concern rather than a functional defect.

No files require special attention, though the style-attribute assertions in ConfirmPopover.test.tsx are worth keeping in mind if Mantine is upgraded.

Important Files Changed

Filename Overview
ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.tsx Adds optional destructive prop; passes color="red" to the OK Button when truthy. Clean prop destructuring before ...rest spread.
ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.test.tsx Adds two tests for the new prop. Tests inspect the inline style attribute for "red", which works but couples the test to Mantine's CSS-custom-property injection — could break silently on a Mantine upgrade.
ui/src/features/datasets/DatasetHeader/DatasetHeader.tsx Adds destructive to the remove-dataset ConfirmPopover; no other changes.
ui/src/features/datasets/ShareDataset/ShareDatasetSidebar.tsx Adds destructive to the unshare-group ConfirmPopover; no other changes.
ui/src/features/reactions/ReactionEntities/ReactionEntityDelete/ReactionEntityDelete.tsx Adds destructive to the entity-delete ConfirmPopover; no other changes.
ui/src/features/reactions/RemoveReaction/RemoveReaction.tsx Adds destructive to the remove-reaction ConfirmPopover; no other changes.

Reviews (1): Last reviewed commit: "fix(ui): red OK button on destructive co..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

The "Remove" buttons turn red on hover (#776); make the confirmation match.
Add an optional `destructive` prop to ConfirmPopover that renders the OK button
in red, and apply it to the remove/delete/unshare confirmations (RemoveReaction,
ReactionEntityDelete, dataset remove in DatasetHeader, dataset unshare in
ShareDatasetSidebar). Non-destructive confirmations are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pulumi

pulumi Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🤖 Pulumi Neo didn't review this pull request: no Pulumi preview ran for it. Agentic reviews require a preview of the affected stacks (for example from your CI's pulumi preview).

@sonarqubecloud

Copy link
Copy Markdown

Comment on lines +57 to +69
it('renders a red OK button for destructive confirmations (#314)', () => {
renderPopover(true);
// Mantine color="red" inlines the red color custom properties on the button element.
expect(
screen.getByRole('button', { name: 'OK' }).getAttribute('style') ?? '',
).toContain('red');
});

it('renders a default (non-red) OK button when not destructive', () => {
renderPopover(false);
expect(
screen.getByRole('button', { name: 'OK' }).getAttribute('style') ?? '',
).not.toContain('red');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Style-attribute sniffing couples tests to Mantine internals

Both new tests assert on the raw style attribute string to detect whether the button is red, relying on the fact that Mantine currently serialises color="red" as inline CSS custom properties that happen to contain the string "red". If Mantine ever moves colour application to a CSS class or changes the custom-property naming convention, both tests would pass or fail spuriously without any change to the component itself. A more robust assertion would check the Mantine data-* attribute or the computed class name that signals the colour variant — or simply verify that the color prop is forwarded correctly at the component level. This is non-blocking, but worth considering before the test pattern is copied elsewhere.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Hover Effect for "Remove" Button across ORD (dataset, reaction, template)

1 participant