Skip to content

Commit

Permalink
Merge branch 'feature/dropdown-bugfixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
kebarvid committed Dec 11, 2020
2 parents 2ea0f1b + d897265 commit 961d5af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Change-log](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

# 7.8.2 (2020-12-11)
- Fixing a bug in `vgr-dropdown-select` where focus got stuck in filter fi deselectable was active.
# 7.8.1 (2020-11-10)
- Various bugfixes for `vgr-dropdown-select`.

# 7.8.0 (2020-11-02)
- Added option for using `vgr-notification` as standalone and new types `warning`, `info`

Expand Down
2 changes: 1 addition & 1 deletion projects/komponentkartan/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vgr-komponentkartan",
"version": "7.8.1",
"version": "7.8.2",
"peerDependencies": {
"@angular/common": "^9.1.7",
"@angular/core": "^9.1.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<div *ngIf="expanded && !readonly && !disabled" class="dropdown-select__menu" role="listbox"
[attr.aria-labelledby]="labelId" [attr.aria-multiselectable]="multi">
<div *ngIf="filterVisible || deselectable || multi" class="dropdown-select__menu__header">
<vgr-input *ngIf="filterVisible" type="search" (keydown)="onFilterKeydown($event)" [(ngModel)]="searchString" (ngModelChange)="filterItems()" (keyup.enter)="toggleSelectAll()" (focusin)="onFilterFocus()" (focusout)="onFilterBlur()">
<vgr-input *ngIf="filterVisible" type="search" (keydown)="onFilterKeydown($event)" [(ngModel)]="searchString" (ngModelChange)="filterItems()" (focusin)="onFilterFocus()" (focusout)="onFilterBlur()">
</vgr-input>
<div *ngIf="filterHasFocus" class="select-all-text">(tryck retur för att välja alla träffar)</div>
<div *ngIf="multi" class="select-all-text" [ngStyle]="{'visibility': filterHasFocus ? 'visible' : 'hidden'}">(tryck retur för att välja alla träffar)</div>
<vgr-button #deselectButton *ngIf="deselectable && !multi" class="dropdown-select__menu__header__deselect"
[buttonStyle]="'discreet'" [disabled]="deselectDisabled" (click)="deselectItems()"
(keydown)="onDeselectKeydown($event)">Ta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export class DropdownSelectComponent implements OnChanges, AfterContentInit, Aft

onHeaderKeydown(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.stopPropagation();
this.expand();

const selectedItems = this.items.filter(item => item.selected);
Expand Down Expand Up @@ -386,10 +387,13 @@ export class DropdownSelectComponent implements OnChanges, AfterContentInit, Aft

if (event.key === ' ' || event.key === 'Spacebar' || event.key === 'Enter') {
event.stopPropagation();
if (event.key === 'Enter') {
this.toggleSelectAll();
}
} else if (event.key === 'ArrowDown' || event.key === 'Down') {
if (this.multi) {
this.selectAll.nativeElement.focus();
} else if (this.deselectable) {
} else if (this.deselectable && this.value) {
this.deselectButton.focus();
} else if (filteredItems.length) {
filteredItems[0].focus();
Expand Down Expand Up @@ -531,7 +535,7 @@ export class DropdownSelectComponent implements OnChanges, AfterContentInit, Aft
filteredItems[itemIndex - 1].focus();
} else if (this.multi) {
this.selectAll.nativeElement.focus();
} else if (this.deselectable) {
} else if (this.deselectable && this.value) {
this.deselectButton.focus();
} else if (this.filterVisible) {
this.filter.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</div>
<div class="one-third">
<p>Stor, 50 alternativ</p>
<vgr-dropdown-select>
<vgr-dropdown-select [deselectable]="true">
<vgr-dropdown-item *ngFor="let item of items50">{{item}}</vgr-dropdown-item>
</vgr-dropdown-select>
</div>
Expand Down

0 comments on commit 961d5af

Please sign in to comment.