`@effect/ui-kit` (Effect-TS/ui): `Popover`: a generated trigger id changes on each render of its Dialog, so the popup loses its anchor
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- accessibility, frontend
Hướng nghiên cứu
Đọc packages/ui-kit/src/Popover.ts, đặc biệt là phần tạo ID của trigger gần dòng 1071 và 1272, cùng selector của trigger đang hoạt động gần dòng 1060–1062. Tái hiện bằng cách bật hoặc tắt một control bên trong popover đang mở, sau đó đóng rồi mở lại popover. Giữ ID trigger được tạo ổn định qua các lần render dialog; hoàn thành khi popup vẫn được neo và trigger giữ aria-expanded="true" mỗi lần mở.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Written with Claude Code for @magoz, from an app we're building on Effect UI.
What version of Effect is running?
| Package | Version |
|---|---|
@effect/ui-kit, @effect/ui (Effect-TS/ui) |
0.0.0 snapshot, reproduced on main at dec1ca9 |
effect |
4.1.7 |
What steps can reproduce the bug?
- A
Popoverwhose trigger has noidof the consumer's (so the kit generates one), and whose popup holds a control that re-renders the popover's innerDialogon its own, e.g. aSwitchthat changes the popup's content. - Open the popover and toggle the switch. Close it, and open it again.
What is the expected behavior?
The popup stays anchored to its trigger on every open, and the trigger keeps aria-expanded="true" while it's open.
What do you see instead?
After the first re-render the popup is placed at the viewport's top-left (--anchor-width: 0px), and the trigger has no aria-expanded. It happens again on every reopen.
Additional information
The trigger's generated id comes from a counter declared in the Popover's parts (Popover.ts#L1071) but incremented inside the child Dialog's parts (Popover.ts#L1272):
const key = idOf(options.element) ?? p.id("trigger", triggers++)
The dialog's parts run on every render of the dialog, also when the popover's own parts don't run (a transition frame, or a re-render the popup's content causes). So the count carries over between runs and the trigger becomes …-trigger-1, then -2. The popover still positions against the id from the open (triggerSelector = idSelector(active), Popover.ts#L1060-L1062), which no element has any more.
A fix that works for us (a local patch): count per run of the dialog's parts, by moving let triggers = 0 from the popover's parts to the start of parts: (dialog) => { … }. Ids stay stable across re-renders as long as triggers are drawn in the same order, which is how Dialog and Menu count theirs. A sturdier form for triggers drawn conditionally or reordered would key the id on the element's .key() when it has one.
Menu, PreviewCard, Dialog and Drawer count their triggers within their own parts and have no child whose parts rerun alone, so they aren't affected.
- Ngôn ngữ chính
- TypeScript
- Star
- 16.7k
- Fork
- 808
- Merge trung bình
- 21 giờ 22 phút
- Pull request đã merge (30 ngày)
- 486
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Effect-TS/effect
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11097 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Có thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11096 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): `internal/focus.ts` `trackKeyboard` ignores `keyboardWillChangeFrame` / `keyboardDidChangeFrame` dismissalCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11095 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Effect-TS/effect
Issue tương tự
-
check:failed streams:edit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
iptv-org/iptv#60585 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsCó thể đã có người làm @Piyush4801 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jaegertracing/jaeger-ui#4865 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày