@fluid-topics/ft-search-input 2.2.31 → 2.2.32

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.
@@ -36,8 +36,7 @@ export declare class FtSearchInput extends FtSearchInput_base implements FtSearc
36
36
  private onClick;
37
37
  private showSuggestionsOnFocus;
38
38
  private onFocus;
39
- focusInput(showSuggestions?: boolean): Promise<void>;
40
- connectedCallback(): Promise<void>;
39
+ connectedCallback(): void;
41
40
  contentAvailableCallback(props: PropertyValues<this>): void;
42
41
  private onPointerDown;
43
42
  }
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { html, nothing, } from "lit";
8
- import { ignoreComposingEvents, isTouchScreen, noTextInputDefaultClearButton, redux, screenReaderStyles, waitFor, } from "@fluid-topics/ft-wc-utils";
8
+ import { FocusHelper, ignoreComposingEvents, noTextInputDefaultClearButton, redux, screenReaderStyles, } from "@fluid-topics/ft-wc-utils";
9
9
  import { styles } from "./ft-search-input.styles";
10
10
  import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
11
11
  import { withI18n } from "@fluid-topics/ft-i18n";
@@ -210,16 +210,16 @@ export class FtSearchInput extends withI18n(FtSearchComponent) {
210
210
  }
211
211
  this.forceCloseSuggestion = false;
212
212
  }
213
- async focusInput(showSuggestions = true) {
214
- this.showSuggestionsOnFocus = showSuggestions;
215
- await waitFor(() => this.input, 50);
216
- this.input.focus();
217
- this.showSuggestionsOnFocus = true;
218
- }
219
- async connectedCallback() {
213
+ connectedCallback() {
220
214
  super.connectedCallback();
221
- if (this.focusOnDisplay && !isTouchScreen) {
222
- this.focusInput(false);
215
+ if (this.focusOnDisplay) {
216
+ this.updateComplete.then(() => {
217
+ if (this.input && FocusHelper.allowAutoFocus(this.input)) {
218
+ this.showSuggestionsOnFocus = false;
219
+ this.input.focus();
220
+ this.showSuggestionsOnFocus = true;
221
+ }
222
+ });
223
223
  }
224
224
  }
225
225
  contentAvailableCallback(props) {