Skip to content

Commit 14fdd7a

Browse files
committed
frontend/dialog: remove disableEscape param, use onClose instead
If onClose is undefined, there is on close button, and ESC should then also not work, and vice versa. This also fixes some dialogs that could be escaped via ESC that shouldn't have, like the BB02 backup check dialog.
1 parent 39f90f8 commit 14fdd7a

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

frontends/web/src/components/dialog/dialog.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type TProps = {
2828
large?: boolean;
2929
slim?: boolean;
3030
centered?: boolean;
31-
disableEscape?: boolean;
3231
onClose?: (e?: Event) => void;
3332
children: React.ReactNode;
3433
open: boolean;
@@ -41,7 +40,6 @@ export const Dialog = ({
4140
large,
4241
slim,
4342
centered,
44-
disableEscape,
4543
onClose,
4644
children,
4745
open,
@@ -169,10 +167,10 @@ export const Dialog = ({
169167
if (!renderDialog) {
170168
return;
171169
}
172-
if (!disableEscape) {
170+
if (onClose !== undefined) {
173171
deactivate(true);
174172
}
175-
}, [renderDialog, disableEscape, deactivate]));
173+
}, [renderDialog, onClose, deactivate]));
176174

177175
useEffect(() => {
178176
if (open) {

frontends/web/src/routes/account/receive/receive-bb01.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ export const Receive = ({
252252
<Dialog
253253
open={((!!account) && forceVerification && verifying)}
254254
title={verifyLabel}
255-
disableEscape={true}
256255
medium centered>
257256
<div className="text-center">
258257
{account && <>

frontends/web/src/routes/account/receive/receive.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,8 @@ export const Receive = ({
291291
<Dialog
292292
open={!!(account && verifying)}
293293
title={t('receive.verifyBitBox02')}
294-
// disable escape for secure outputs like the BitBox02, where the dialog is
294+
// disable exit/escape for secure outputs like the BitBox02, where the dialog is
295295
// dimissed by tapping the device
296-
disableEscape={verifying === 'secure'}
297296
onClose={verifying === 'insecure' ? () => {
298297
setVerifying(false);
299298
} : undefined}

frontends/web/src/routes/buy/pocket.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ export const Pocket = ({ code }: TProps) => {
245245
<Dialog
246246
open={verifying}
247247
title={t('receive.verifyBitBox02')}
248-
disableEscape={true}
249248
medium centered>
250249
<div className="text-center">{t('buy.pocket.verifyBitBox02')}</div>
251250
</Dialog>

0 commit comments

Comments
 (0)