Skip to content

Commit 913b681

Browse files
committed
chore: hide close button
1 parent 32e1afa commit 913b681

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

elements/pf-search-input/pf-search-input.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class PfSearchInput extends LitElement {
197197
>
198198
<pf-button
199199
@click="${this.#OnClose}"
200-
?hidden="${(!expanded && this._toggleInput?.value.trim() === '')}"
200+
?hidden="${this.#hideCloseButton()}"
201201
id="close-button"
202202
plain
203203
label="Close"
@@ -329,6 +329,13 @@ export class PfSearchInput extends LitElement {
329329
this._toggleInput!.value = this.value;
330330
this.#combobox.selected = [];
331331
}
332+
333+
#hideCloseButton() {
334+
if (!isServer) {
335+
return !this.expanded && this._toggleInput?.value.trim() === ''; // SSR or server-side environment: don't hide the element
336+
}
337+
return false;
338+
}
332339
}
333340

334341
declare global {

0 commit comments

Comments
 (0)