Autocomplete: when using the keyboard to navigate the options, the currently focused item should be the 'selected' option
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
#### Bug, feature request, or proposal:
Feature request
#### What is the expected behavior?
When using the keyboard to navigate through the options, as the focus changes from one option to another, the selected option should be the currently focused option, thus following the "selection follow focus" principle as stated in the Material docs [here](https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus).
If the desire is to leave the current behavior then at least provide an option to turn this behavior on.
#### What is the current behavior?
Using the keyboard to navigate the options does not automatically update the 'selected' option.
#### What is the use-case or motivation for changing an existing behavior?
Many users expect to be able to select an option by simply navigating the options without being required to press a particular key to indicate their selection. By simply leaving the current control after having navigating to a particular option, they assume that they have selected the option as well. The main example I have for this is using the TAB key. I often navigate options using the arrow key and then press the TAB key after having 'selected' my option using the arrow keys. The current behavior is such that you are required to 'select' the option using the ENTER key, otherwise the value is not set when you TAB away from the control.
Google's own search engine follows this principle. As you type in your search, Google begins searching for the phrase and provides several autocomplete phrases for you. If you navigate the provided phrases, the search results update based on the currently focused phrase without having pressed ENTER or another key.
#### Is there anything else we should know?
See [this](https://github.com/angular/material2/pull/4401) pull request for the initial discussion.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng việc xem xét pull request #4401 được liên kết và cuộc thảo luận hiện có gồm 17 bình luận để hiểu các lựa chọn về hành vi vẫn chưa được giải quyết. Tiếp theo, lần theo phần triển khai Angular Material autocomplete từ điểm vào của component, rồi xác định liệu completion nên khiến focus đi theo selection hay cung cấp một tùy chọn cho hành vi đó. Được xem là hoàn thành khi hành vi được chọn đã được triển khai và xác minh đối với thao tác điều hướng bằng phím mũi tên rồi nhấn TAB, đồng thời flow ENTER hiện có đã được xử lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100