Skip to content

Commit

Permalink
Fix Markdown cards in Grid not taking full height
Browse files Browse the repository at this point in the history
The implementation of show_empty property in #21379 introduced
regression which causes Markdown cards rendered within a Grid card to
not take full height of its space. This is because a visible card is now
forced to have "display: block", while without that it's rendered as
"display: inline".

As the CSSStyleDeclaration.style mandates string type, it's not possible
to delete or null the value. Setting it to an empty string seems to do
the trick as well and the linter is happy too.

Fixes #23119
  • Loading branch information
sairon committed Dec 3, 2024
1 parent 614c4ec commit 407e439
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/panels/lovelace/cards/hui-markdown-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class HuiMarkdownCard extends LitElement implements LovelaceCard {
this._config.show_empty === false &&
this._templateResult.result.length === 0;
if (shouldBeHidden !== this.hidden) {
this.style.display = shouldBeHidden ? "none" : "block";
this.style.display = shouldBeHidden ? "none" : "";
this.toggleAttribute("hidden", shouldBeHidden);
fireEvent(this, "card-visibility-changed", { value: !shouldBeHidden });
}
Expand Down

0 comments on commit 407e439

Please sign in to comment.