使用键盘在md-select中选择项目 [英] Using keyboard to select items in md-select

查看:43
本文介绍了使用键盘在md-select中选择项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用augular/material2 md-select.当我进入md-select组件时,可以使用向上和向下箭头选择项目.我还可以按空格键查看列表,并使用上下箭头和Enter键选择一个项目.我不能做的是按一个项目的第一个字母,然后选择该项目.

I'm using augular/material2 md-select. When I tab into the md-select component I can use the up and down arrows to select items. I can also press the space bar to see the list and use the up and down arrows and the enter key to select an item. What I can't do is press the first letter of an item and have that item selected.

使用 https://material.angular.io/components/component/select 我希望能够使用Tab键进入md-select组件,然后按P键选择Pizza.不支持吗?有解决方法吗?

Using the example on https://material.angular.io/components/component/select I'd expect to be able to tab into the md-select component and press P to select Pizza. Is this not supported? Is there a work around?

谢谢

推荐答案

在材料文档中,仅支持以下键盘交互:

In material doc, only following keyboard interactions are supported:

  • DOWN_ARROW:关注下一个选项
  • UP_ARROW:关注上一个选项
  • 输入或空格:选择重点项目

按项目的首字母并选择该项目"的功能很难实现,因为很难预测列表中可能存在多少个具有相同首字母的项目.如果列表中包含PIZZA,POPCORN,PASTA等项目,应按"P"选择哪个项目?

The functionality of 'press the first letter of an item and have that item selected' is difficult to implement, because its hard to predict, how many items with same initial letter might exist in the list. If the list has items PIZZA, POPCORN, PASTA, which item should be selected by pressing 'P'?

如果您想按所按字母过滤项目,那么您可能想看看md-autocomplte.

If you are thinking of filtering items by letters pressed, then you might want to have a look at md-autocomplte.

https://material.angular.io/components/component/autocomplete

这篇关于使用键盘在md-select中选择项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆