angular / angular/components

bug(Listbox): Can not select first option with Enter after calling .goToFirst() (@angular/aria)

Đang mở
#32,762 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: aria/listbox P3
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ả

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

When calling `.goToFirst()` the first option is set active. But it is not possible to select it with _Enter_. If the user hits _arrow down_ one time you can select the first option. But my whole reason for calling `.goToFirst()` is so the user do not need arrows when first option is the one they want.

I suspect an underlying keyboard manager is not being synced when calling `.goToFirst()'

### Reproduction

StackBlitz link: https://stackblitz.com/edit/go-to-first-issue-angular-aria-wpcbw3sz?file=src%2FApp.ts
Steps to reproduce:
1. Load stackblitz
2. Hit enter
Hitting enter should trigger en alert with the text "Option 0", but it does not happen

### Expected Behavior

When calling `.goToFirst()` the first option is selected and hitting Enter on the keyboard will select it.

### Actual Behavior

Nothing happens when hitting Enter

### Environment

- Angular: 21.1.3
- CDK/Material: 21.1.3
- Browser(s): Edge, Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows, Macos

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết, đặc biệt là src/App.ts, và tái hiện chuỗi .goToFirst() rồi Enter. Điều tra vấn đề đồng bộ hóa keyboard-manager được nghi ngờ và xác minh rằng việc nhấn Enter sau khi di chuyển đến tùy chọn đầu tiên sẽ kích hoạt một alert chứa "Option 0" mà không cần Arrow Down.

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
accessibility, frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
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
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.