material-components-web icon indicating copy to clipboard operation
material-components-web copied to clipboard

[mdc-select] [a11y] support typeahead

Open kvdheuvel opened this issue 6 years ago • 6 comments

Bug report

The new mdc-select component does not support first letter navigation like the default 'select' > 'option' variant does.

Steps to reproduce

Open the a11y variant of the mdc-select component and try to navigate to a list item with the keyboard.

Actual behavior

The list items wont get selected

Expected behavior

That the list item can be selected with the keyboard by selecting the first letter

Your Environment:

Software Version(s)
MDC Web 4.0.0
Browser Chrome
Operating System Windows

kvdheuvel avatar Mar 11 '20 07:03 kvdheuvel

Thanks for the bug! We're currently working on select, so we'll add this to the features requested for it

asyncliz avatar Mar 11 '20 16:03 asyncliz

Hi,

We've prototyped this feature in the list foundation and will keep this issue updated as to its rollout status. FYI, the currently the prescribed behavior is:

  • Type a character: focus moves to the next item with a name that starts with the typed character.
  • Type multiple characters in rapid succession: focus moves to the next item with a name that starts with the string of characters typed.

From https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html

allan-chen avatar Mar 11 '20 17:03 allan-chen

First letter navigation doesn't work. As reference you can see on demo page: https://material-components.github.io/material-components-web-catalog/#/component/select

ivangusev avatar Jul 21 '20 07:07 ivangusev

The demo is on v4.0 and needs to be updated. Meanwhile you can play with the latest version (v7) here: https://codepen.io/allanchenmdc/pen/MWKEqrK

allan-chen avatar Jul 21 '20 07:07 allan-chen

@allan-chen Thanks, it works in codepen. Btw, can you please suggest how to make it open always down (i have a long list and it opens up, v6) and if possible to limit height of the list?

ivangusev avatar Jul 21 '20 11:07 ivangusev

Glad it works! Menusurface opens up if there's not enough space to open downwards. One way to nudge it to open down is to restrict the max-height of the mdc-select__menu element so there's more often than not space to open below. Hope this helps!

allan-chen avatar Jul 21 '20 17:07 allan-chen