Skip to content

Commit

Permalink
Merge pull request #156 from CovidTrackerFr/autocomplete-cleaning-fixes
Browse files Browse the repository at this point in the history
Régression autocomplete
  • Loading branch information
Luwangel authored May 6, 2021
2 parents 48e4f6a + 2bd49da commit 7b193f4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/vmd-commune-or-departement-selector.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class VmdCommuneOrDepartmentSelectorComponent extends LitElement {
// is still at the 'start' of current filter
// This is intended to detect start of filter string modifications which would invalidate
// the current autocompleteFilter
if(this.filterMatchingAutocomplete && this.filter.includes(this.filterMatchingAutocomplete)) {
if(this.filterMatchingAutocomplete && !this.filter.startsWith(this.filterMatchingAutocomplete)) {
this.filterMatchingAutocomplete = undefined;
}

Expand Down Expand Up @@ -239,10 +239,12 @@ export class VmdCommuneOrDepartmentSelectorComponent extends LitElement {
if(!filterMatchedAnAutocomplete) {
this.communesDisponibles = [];
}
}

if (this.$autoCompleteResults) {
this.$autoCompleteResults.scrollTop = 0;
}
this.filtrerDepartementsAffichees();

if (this.$autoCompleteResults) {
this.$autoCompleteResults.scrollTop = 0;
}
}

Expand Down Expand Up @@ -318,7 +320,7 @@ export class VmdCommuneOrDepartmentSelectorComponent extends LitElement {
return html`<li
class="autocomplete-result"
role="option"
aria-selected="${index === 0}"
aria-selected="${index === 0 && this.departementsAffiches.length === 0}"
@click="${() => this.communeSelected(commune)}"
>
<span class="zipcode">${commune.codePostal}</span> - ${commune.nom}
Expand Down

0 comments on commit 7b193f4

Please sign in to comment.