@fluid-topics/ft-filter 1.2.50 → 1.2.51

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.
@@ -23,6 +23,7 @@ export declare class FtFilterLevel extends FtLitElement {
23
23
  get height(): number;
24
24
  focusOnBackButton(): void;
25
25
  focusOnExpandButton(value: string): void;
26
+ focusOnFirstOption(): void;
26
27
  protected render(): import("lit-html").TemplateResult<1>;
27
28
  private goBackOnKeyPress;
28
29
  private goBackOnClick;
@@ -44,14 +44,17 @@ class FtFilterLevel extends FtLitElement {
44
44
  focusOnBackButton() {
45
45
  this.elementToFocus = {
46
46
  selector: `.ft-filter-level--go-back`,
47
- isKeyboardNavigation: true,
48
47
  };
49
48
  }
50
49
  focusOnExpandButton(value) {
51
50
  // Find the correct expand button associated with the checkbox value
52
51
  this.elementToFocus = {
53
52
  selector: `.ft-filter-level--option ft-button[part="controls navigate-hierarchy"][data-value="${value}"]`,
54
- isKeyboardNavigation: true,
53
+ };
54
+ }
55
+ focusOnFirstOption() {
56
+ this.elementToFocus = {
57
+ selector: `.ft-filter-level--option [part~="option"]`,
55
58
  };
56
59
  }
57
60
  render() {
@@ -131,11 +134,11 @@ class FtFilterLevel extends FtLitElement {
131
134
  displayMore() {
132
135
  var _a;
133
136
  const previousLimit = (_a = this.limit) !== null && _a !== void 0 ? _a : 0;
137
+ const hasGoBackButton = this.parent != null;
134
138
  this.displayedPages++;
135
139
  // Wait for the component update before focusing on the first new option
136
140
  this.elementToFocus = {
137
- selector: `.ft-filter-level--option:nth-child(${previousLimit + 2}) [part~="option"]`,
138
- isKeyboardNavigation: true,
141
+ selector: `.ft-filter-level--option:nth-child(${previousLimit + (hasGoBackButton ? 2 : 1)}) [part~="option"]`,
139
142
  };
140
143
  }
141
144
  buildMultiValuedOption(option) {
@@ -45,6 +45,7 @@ export declare class FtFilter extends FtLitElement implements FtFilterProperties
45
45
  private renderLevel;
46
46
  private goBack;
47
47
  private onDisplayLevel;
48
+ focusOnFirstOption(): void;
48
49
  clear(): void;
49
50
  private onChange;
50
51
  private changeDebouncer;
@@ -68,7 +68,10 @@ class FtFilter extends FtLitElement {
68
68
  <slot name="label"></slot>
69
69
  </div>
70
70
  ${valuesSelected && !this.hideClearButton ? html `
71
- <ft-button icon="close" dense @click=${this.clear} part="clear-button">
71
+ <ft-button icon="close" dense @click=${() => {
72
+ this.clear();
73
+ this.focusOnFirstOption();
74
+ }} part="clear-button">
72
75
  ${this.clearButtonLabel}
73
76
  </ft-button>
74
77
  ` : null}
@@ -216,6 +219,13 @@ class FtFilter extends FtLitElement {
216
219
  newLevel === null || newLevel === void 0 ? void 0 : newLevel.focusOnBackButton();
217
220
  });
218
221
  }
222
+ focusOnFirstOption() {
223
+ waitUntil(() => this.slideOut === undefined).then(() => {
224
+ var _a;
225
+ const firstLevel = (_a = this.levelsContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".ft-filter--level-center");
226
+ firstLevel === null || firstLevel === void 0 ? void 0 : firstLevel.focusOnFirstOption();
227
+ });
228
+ }
219
229
  clear() {
220
230
  this.flatOptions.forEach(o => o.selected = false);
221
231
  if (this.displayedLevels.length > 0) {