Merge "Fix nav overlapping settings on specific screen sizes"
diff --git a/Documentation/intro-user.txt b/Documentation/intro-user.txt
index 264ce73..7a042ba 100644
--- a/Documentation/intro-user.txt
+++ b/Documentation/intro-user.txt
@@ -1014,7 +1014,7 @@
inline comment ("Yeah, I see why, let me try again.").
[[security-fixes]]
--- Security Fixes
+== Security Fixes
If a security vulnerability is discovered you normally want to have an
embargo about it until fixed releases have been made available. This
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index e5720b84..090dfef 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -130,6 +130,9 @@
@query('#confirmDeleteModal')
confirmDeleteModal?: HTMLDialogElement;
+ @query('#confirmDeleteCommentDialog')
+ confirmDeleteDialog?: GrConfirmDeleteCommentDialog;
+
@property({type: Object})
comment?: Comment;
@@ -200,9 +203,6 @@
unresolved = true;
@property({type: Boolean})
- showConfirmDeleteModal = false;
-
- @property({type: Boolean})
unableToSave = false;
@property({type: Boolean, attribute: 'show-patchset'})
@@ -940,11 +940,10 @@
}
private renderConfirmDialog() {
- if (!this.showConfirmDeleteModal) return;
return html`
<dialog id="confirmDeleteModal" tabindex="-1">
<gr-confirm-delete-comment-dialog
- id="confirmDeleteComment"
+ id="confirmDeleteCommentDialog"
@confirm=${this.handleConfirmDeleteComment}
@cancel=${this.closeDeleteCommentModal}
>
@@ -1264,15 +1263,14 @@
}
}
- private async openDeleteCommentModal() {
- this.showConfirmDeleteModal = true;
- await this.updateComplete;
- await this.confirmDeleteModal?.showModal();
+ private openDeleteCommentModal() {
+ this.confirmDeleteModal?.showModal();
+ whenVisible(this.confirmDeleteDialog!, () => {
+ this.confirmDeleteDialog!.resetFocus();
+ });
}
private closeDeleteCommentModal() {
- this.showConfirmDeleteModal = false;
- this.confirmDeleteModal?.remove();
this.confirmDeleteModal?.close();
}
@@ -1282,10 +1280,7 @@
*/
// private, but visible for testing
async handleConfirmDeleteComment() {
- const dialog = this.confirmDeleteModal?.querySelector(
- '#confirmDeleteComment'
- ) as GrConfirmDeleteCommentDialog | null;
- if (!dialog || !dialog.message) {
+ if (!this.confirmDeleteDialog || !this.confirmDeleteDialog.message) {
throw new Error('missing confirm delete dialog');
}
assertIsDefined(this.changeNum, 'changeNum');
@@ -1294,7 +1289,7 @@
await this.getCommentsModel().deleteComment(
this.changeNum,
this.comment,
- dialog.message
+ this.confirmDeleteDialog.message
);
this.closeDeleteCommentModal();
}
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
index 5b191c8..ec9c875 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
@@ -127,6 +127,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteCommentDialog">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -166,6 +170,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteCommentDialog">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -238,6 +246,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteCommentDialog">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -336,6 +348,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteCommentDialog">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -421,6 +437,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteCommentDialog">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -503,7 +523,7 @@
assertIsDefined(element.confirmDeleteModal, 'confirmDeleteModal');
const dialog = queryAndAssert<GrConfirmDeleteCommentDialog>(
element.confirmDeleteModal,
- '#confirmDeleteComment'
+ '#confirmDeleteCommentDialog'
);
dialog.message = 'removal reason';
await element.updateComplete;
diff --git a/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog.ts b/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog.ts
index b6512b3..285a41a 100644
--- a/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog.ts
+++ b/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog.ts
@@ -75,6 +75,7 @@
override render() {
return html` <gr-dialog
confirm-label="Delete"
+ ?disabled=${this.message === ''}
@confirm=${this.handleConfirmTap}
@cancel=${this.handleCancelTap}
>
diff --git a/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts b/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts
index bd84ac4..b7551c1 100644
--- a/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts
@@ -7,6 +7,7 @@
import {fixture, html, assert} from '@open-wc/testing';
import {GrConfirmDeleteCommentDialog} from './gr-confirm-delete-comment-dialog';
import './gr-confirm-delete-comment-dialog';
+import {GrDialog} from '../gr-dialog/gr-dialog';
suite('gr-confirm-delete-comment-dialog tests', () => {
let element: GrConfirmDeleteCommentDialog;
@@ -17,7 +18,10 @@
);
});
- test('render', () => {
+ test('render', async () => {
+ element.message = 'Just cause';
+ await element.updateComplete;
+
// prettier and shadowDom string disagree about wrapping in <p> tag.
assert.shadowDom.equal(
element,
@@ -43,4 +47,13 @@
`
);
});
+
+ test('dialog is disabled when message is empty', async () => {
+ element.message = '';
+ await element.updateComplete;
+
+ assert.isTrue(
+ (element.shadowRoot!.querySelector('gr-dialog') as GrDialog).disabled
+ );
+ });
});