Skip to content

Commit

Permalink
fix(select): disable opening disabled select after clicking on content (
Browse files Browse the repository at this point in the history
  • Loading branch information
sashaqred committed May 26, 2022
1 parent 8e01fca commit 1c6ef1b
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions src/framework/theme/components/select/select.component.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
<button [disabled]="disabled"
[ngClass]="selectButtonClasses"
(blur)="trySetTouched()"
(keydown.arrowDown)="show()"
(keydown.arrowUp)="show()"
class="select-button"
type="button"
#selectButton>

<span>
<ng-container *ngIf="selectionModel.length; else placeholderTemplate">
<ng-container *ngIf="customLabel; else defaultSelectionTemplate">
<ng-content select="nb-select-label"></ng-content>
</ng-container>

<ng-template #defaultSelectionTemplate>{{ selectionView }}</ng-template>
<button
[disabled]="disabled"
[ngClass]="selectButtonClasses"
(blur)="trySetTouched()"
(keydown.arrowDown)="show()"
(keydown.arrowUp)="show()"
class="select-button"
type="button"
#selectButton
>
<span (click)="disabled && $event.stopPropagation()">
<ng-container *ngIf="selectionModel.length; else placeholderTemplate">
<ng-container *ngIf="customLabel; else defaultSelectionTemplate">
<ng-content select="nb-select-label"></ng-content>
</ng-container>

<ng-template #placeholderTemplate>{{ placeholder }}</ng-template>
</span>
<ng-template #defaultSelectionTemplate>{{ selectionView }}</ng-template>
</ng-container>

<ng-template #placeholderTemplate>{{ placeholder }}</ng-template>
</span>

<nb-icon icon="chevron-down-outline" pack="nebular-essentials" (click)="disabled && $event.stopPropagation()" aria-hidden="true">
</nb-icon>
<nb-icon
icon="chevron-down-outline"
pack="nebular-essentials"
(click)="disabled && $event.stopPropagation()"
aria-hidden="true"
>
</nb-icon>
</button>

<nb-option-list *nbPortal [size]="size" [position]="overlayPosition" [style.width.px]="optionsWidth" [ngClass]="optionsListClass">
<nb-option-list
*nbPortal
[size]="size"
[position]="overlayPosition"
[style.width.px]="optionsWidth"
[ngClass]="optionsListClass"
>
<ng-content select="nb-option, nb-option-group"></ng-content>
</nb-option-list>

0 comments on commit 1c6ef1b

Please sign in to comment.