@fluid-topics/ft-search-input 2.1.23 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { PropertyValues } from "lit";
1
2
  import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
2
3
  import { FtSearchInputProperties } from "./ft-search-input.properties";
3
4
  import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
@@ -37,7 +38,7 @@ export declare class FtSearchInput extends FtSearchInput_base implements FtSearc
37
38
  private onFocus;
38
39
  focusInput(showSuggestions?: boolean): Promise<void>;
39
40
  connectedCallback(): Promise<void>;
40
- disconnectedCallback(): void;
41
+ contentAvailableCallback(props: PropertyValues<this>): void;
41
42
  private onPointerDown;
42
43
  }
43
44
  export {};
@@ -77,7 +77,9 @@ export class FtSearchInput extends withI18n(FtSearchComponent) {
77
77
  @keyup=${this.onSearchBarKeyUp}>
78
78
  </div>
79
79
  <div class="sr-only" aria-live="polite" aria-atomic="true">
80
- ${displaySuggestions ? searchInputContext.messages.ariaLiveSuggestions(this.suggestions.recentQueriesCount(), this.suggestions.suggestionsCount()) : ""}
80
+ ${displaySuggestions
81
+ ? searchInputContext.messages.ariaLiveSuggestions(this.suggestions.recentQueriesCount(), this.suggestions.suggestionsCount())
82
+ : ""}
81
83
  </div>
82
84
  ${displaySuggestions ? this.suggestions.render() : nothing}
83
85
  </div>
@@ -216,14 +218,20 @@ export class FtSearchInput extends withI18n(FtSearchComponent) {
216
218
  }
217
219
  async connectedCallback() {
218
220
  super.connectedCallback();
219
- document.addEventListener("pointerdown", this.onPointerDown);
220
221
  if (this.focusOnDisplay && !isTouchScreen) {
221
222
  this.focusInput(false);
222
223
  }
223
224
  }
224
- disconnectedCallback() {
225
- super.disconnectedCallback();
226
- document.removeEventListener("pointerdown", this.onPointerDown);
225
+ contentAvailableCallback(props) {
226
+ super.contentAvailableCallback(props);
227
+ if (props.has("displaySuggestListbox")) {
228
+ if (this.displaySuggestListbox) {
229
+ document.addEventListener("pointerdown", this.onPointerDown);
230
+ }
231
+ else {
232
+ document.removeEventListener("pointerdown", this.onPointerDown);
233
+ }
234
+ }
227
235
  }
228
236
  }
229
237
  FtSearchInput.elementDefinitions = {