Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: better dialog action buttons focus

thecodrre62a30213c64
diff --git a/apps/web/src/components/dialogs/confirm.js b/apps/web/src/components/dialogs/confirm.js
index 1c89e44f4..c412d8860 100644
--- a/apps/web/src/components/dialogs/confirm.js
+++ b/apps/web/src/components/dialogs/confirm.js
@@ -14,6 +14,7 @@ function Confirm(props) {
positiveButton={{
text: props.yesText,
onClick: props.onYes,
+ autoFocus: !!props.yesText,
}}
negativeButton={
props.noText && { text: props.noText, onClick: props.onNo }
diff --git a/apps/web/src/components/dialogs/dialog.js b/apps/web/src/components/dialogs/dialog.js
index eeb8eb22f..90d4cc1e2 100644
--- a/apps/web/src/components/dialogs/dialog.js
+++ b/apps/web/src/components/dialogs/dialog.js
@@ -111,6 +111,7 @@ function Dialog(props) {
data-test-id="dialog-yes"
sx={{ opacity: props.positiveButton.disabled ? 0.7 : 1 }}
mx={1}
+ autoFocus={props.positiveButton.autoFocus}
disabled={props.positiveButton.disabled || false}
onClick={
!props.positiveButton.disabled
diff --git a/apps/web/src/theme/variants/button.js b/apps/web/src/theme/variants/button.js
index ce34a8e19..b5b1ab5c9 100644
--- a/apps/web/src/theme/variants/button.js
+++ b/apps/web/src/theme/variants/button.js
@@ -45,6 +45,10 @@ class Primary {
":hover": {
opacity: 0.8,
},
+ ":focus-visible": {
+ border: "2px solid",
+ borderColor: "text",
+ },
};
}
}