Skip to content

Commit

Permalink
Change to hide empty message element in dialogs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanceewing committed May 6, 2024
1 parent d6b1bbf commit 19f90b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions html/webapp/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ class Dialog {
this.elements.message.innerText = dialog.message;
this.elements.target = dialog.target || '';
this.elements.template.innerHTML = dialog.template || '';

// If no message was provided, then the message element will be hidden.
if (dialog.message === '') {
this.elements.message.className = 'empty';
} else {
this.elements.message.className = '';
}

this.focusable = this.getFocusable();
this.hasFormData = this.elements.fieldset.elements.length > 0;
Expand Down
4 changes: 4 additions & 0 deletions html/webapp/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ a {
transform: translateX(-50%);
}

:where([data-component*="dialog"] legend.empty) {
display: none;
}

:where([data-component*="dialog"] menu) {
gap: calc(var(--dlg-gap)/2);
justify-content: var(--dlg-menu-jc, flex-end);
Expand Down

0 comments on commit 19f90b1

Please sign in to comment.