diff --git a/src/components/confirmdialog/ConfirmDialog.vue b/src/components/confirmdialog/ConfirmDialog.vue
index ebfc9031e..d4fe0ca34 100644
--- a/src/components/confirmdialog/ConfirmDialog.vue
+++ b/src/components/confirmdialog/ConfirmDialog.vue
@@ -4,8 +4,8 @@
{{message}}
-
-
+
+
@@ -104,6 +104,13 @@ export default {
},
rejectClass() {
return ['p-confirm-dialog-reject', this.confirmation ? (this.confirmation.rejectClass || 'p-button-text') : null];
+ },
+ autoFocusAccept() {
+ return this.confirmation.defaultFocus === 'accept' ? true : false;
+ },
+ autoFocusReject() {
+ // backward compatibility
+ return this.confirmation.defaultFocus !== 'accept' ? true : false;
}
},
components: {
diff --git a/src/views/confirmdialog/ConfirmDialogDoc.vue b/src/views/confirmdialog/ConfirmDialogDoc.vue
index 40ec02a9c..b17e807df 100644
--- a/src/views/confirmdialog/ConfirmDialogDoc.vue
+++ b/src/views/confirmdialog/ConfirmDialogDoc.vue
@@ -192,6 +192,12 @@ export default {
true |
Whether background scroll should be blocked when dialog is visible. |
+
+ defaultFocus |
+ string |
+ null |
+ Element to receive the focus when the dialog gets visible, valid values are "accept" and "reject". |
+