Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1668 (pull request #443)
Browse files Browse the repository at this point in the history
SHIBUI-1668 Fixed issue with announcement

Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
rmathis committed Dec 3, 2019
2 parents ab43b18 + 4839c6e commit 5c3977a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
class="component-control"
limit="10"
[formControl]="search"
[matches]="ids$ | async"
[matches]="ids"
(keydown.enter)="onSelectValue(search.value)">
</auto-complete>
<small [class.text-danger]="search.invalid && search.touched" translate="message.entity-id-min-unique">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class FilterTargetComponent extends ObjectWidget implements OnDestroy, Af
) {
super();
this.ids$ = this.store.select(fromFilters.getEntityCollection);
this.ids$.subscribe(ids => this.ids = ids);
this.ids$.subscribe(ids => {
this.ids = [...ids];
});

this.search
.valueChanges
Expand Down
6 changes: 4 additions & 2 deletions ui/src/app/shared/autocomplete/autocomplete.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
role="option"
[attr.aria-selected]="state.currentState.focused === i"
[innerHTML]="option | highlight:this.input.value"></li>
<li class="dropdown-item dropdown-item-noresults" *ngIf="matches && matches.length === 0 && !processing">
<li class="dropdown-item dropdown-item-noresults"
role="option"
*ngIf="matches && matches.length === 0 && !processing">
{{ noneFoundText }}
</li>
</ul>
</ul>
12 changes: 9 additions & 3 deletions ui/src/app/shared/autocomplete/autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,15 @@ export class AutoCompleteComponent implements OnInit, OnDestroy, OnChanges, Afte

ngOnChanges(changes: SimpleChanges): void {
if (changes.matches && this.matches) {
const count = this.matches.length;
this.live.announce(count === 0 ? 'No results available' : `${count} result${count === 1 ? '' : 's'} available`);
this.announceResults();
}
}

announceResults(): void {
const count = this.matches.length;
this.live.announce(count === 0 ? 'No results available' : `${count} result${count === 1 ? '' : 's'} available`);
}

writeValue(value: any): void {
this.input.setValue(value);
}
Expand Down Expand Up @@ -223,6 +227,8 @@ export class AutoCompleteComponent implements OnInit, OnDestroy, OnChanges, Afte
selected: searchForOptions ? ((autoselect && optionsAvailable) ? 0 : -1) : null
});
this.propagateChange(query);

setTimeout(() => this.announceResults(), 250);
}

handleInputFocus(): void {
Expand Down Expand Up @@ -362,4 +368,4 @@ export class AutoCompleteComponent implements OnInit, OnDestroy, OnChanges, Afte
...this.state.currentState
};
}
} /* istanbul ignore next */
}

0 comments on commit 5c3977a

Please sign in to comment.