Skip to content

Commit 6615cb6

Browse files
authored
Focus confirm button instead of cancel in modals (#2340)
focus confirm button instead of cancel in modals
1 parent e48b009 commit 6615cb6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/ui/lib/Modal.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,9 @@ Modal.Footer = ({
135135
}) => (
136136
<footer className="flex items-center justify-between border-t px-3 py-3 border-secondary">
137137
<div className="mr-4">{children}</div>
138-
<div className="space-x-2">
139-
<Button variant="secondary" size="sm" onClick={onDismiss}>
140-
{cancelText || 'Cancel'}
141-
</Button>
138+
<div className="flex flex-row-reverse gap-2">
139+
{/* Note the confirm button is first so it autofocuses when the modal opens,
140+
but it displays in the right order because of flex-row-reverse */}
142141
<Button
143142
size="sm"
144143
variant={actionType}
@@ -148,6 +147,9 @@ Modal.Footer = ({
148147
>
149148
{actionText}
150149
</Button>
150+
<Button variant="secondary" size="sm" onClick={onDismiss}>
151+
{cancelText || 'Cancel'}
152+
</Button>
151153
</div>
152154
</footer>
153155
)

0 commit comments

Comments
 (0)