mat-select has keyboard interaction: up arrow, down arrow to select previous or next option, space/enter to select option and letter to match list item. I need to disable this keyboard interaction. How to disable this?
I've added the following without success: https://stackblitz.com/edit/angular-6kcps1?file=app/select-multiple-example.html Angular: 5.2.9, angular/material :5.2.2What is the expected behavior?
What is the current behavior?
What are the steps to reproduce?
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
There isn't a way to disable this.
@jelbourn can i make pull request for this ?
i need this !
I don't think this is a feature we would want to add since it effectively turns off a11y
hmm,
i'm try to make custom select with search input in top (like use : panelClass ). but when i try to type like :
"search some item" .
this is not can't work , cause the SELECT lock KEYBOARD EVENT 'SPACE'.
Do you have an alternative for select with autocomplete?
because use just AutoComplete and add some trick method is so painful and hard for some programmer and think not effective.
i have example for this, in angular js : https://material.angularjs.org/latest/demo/select#select-header
like the example given by @dreamid27 . adding (keydown)="$event.stopPropagation()" with your input. Example with custom filter in mat-select:
`<mat-select multiple placeholder="List of campaign" [(value)]="campaignsSelected"
formControlName="excludeCampaigns">
<input class="select-filter" type="text" (keyup)="filterList($event.target.value, 'campaigns')"
placeholder="Enter name or ID campaign" (keydown)="$event.stopPropagation()">
<mat-option *ngFor="let campaign of campaigns" [value]="campaign">
{{campaign.id}} - {{campaign.name}} - {{campaign.campaignDate}}
</mat-option>
</mat-select>`
Now, i can press space or enter without select a item in my list. enjoy :)
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
like the example given by @dreamid27 . adding (keydown)="$event.stopPropagation()" with your input. Example with custom filter in mat-select:
Now, i can press space or enter without select a item in my list. enjoy :)