在 https://material-ui.com/components/autocomplete/ 上使用 playground 研究 Material-UI 的自动完成功能,我真的看不出有/没有 includeInputInList 属性有什么区别?该文件说“如果为真,突出显示可以移动到输入。”我试过了,突出显示永远不会移动到输入字段。
最佳答案
includeInputInList
有 2 associated unit tests .
测试的描述说:
it considers the textbox the predessor of the first option when pressing Up
it considers the textbox the successor of the last option when pressing Down
这意味着使用 includeInputInList
,当您将焦点放在组件上并按下向上键时,如果它是第一项,焦点将转到文本框(输入元素),然后继续项目。如果你按下它是最后一项,焦点也会转到文本框。
如果没有该选项,焦点将停留在显示的项目上,永远不会转到文本框,它会从第一个项目跳到最后一个项目(向上键),并在您获得焦点时从最后一个跳到第一个(向下键)在它们上,只需按向上键或向下键。
你可以试试on the example provided on the Material UI docs :按 Tab 键直到您位于 MUI 组件上,然后使用向上或向下键播放,有或没有 Autocomplete
组件上的 includeInputInList
属性。
关于autocomplete - 什么是 includeInputInList 属性用于 Material-ui 的自动完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66328701/