`@effect/ui` (Effect-TS/ui): a controlled `details` loses a second summary press made before the next frame
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What version of Effect is running?
@effect/ui from Effect-TS/ui at 94271bb (current main, via pkg.pr.new), effect 4.1.5. Chromium, Firefox and WebKit from Playwright 1.65.
What steps can reproduce the bug?
A details whose open the Model controls, as the .open() docs describe:
import { UiSchema } from "@effect/ui"
import { BrowserHost, Html } from "@effect/ui/html"
import { Effect, Layer, Schema } from "effect"
const Message = UiSchema.TaggedEnum({ Toggled: { open: Schema.Boolean } })
const Fold = Html.component({
name: "Fold",
model: Schema.Struct({ open: Schema.Boolean }),
message: Message
}).make({
init: () => ({ open: false }),
update: { Toggled: ($, { open }) => $.evolve({ open: () => open }) },
view: (h, model) =>
h.details
.open(model.open)
.on("toggle", ({ open }) => Message.Toggled({ open }))
.children(h.summary.children("More"), h.p.children("Details"))
})
Layer.launch(BrowserHost.mount(Fold, {}, document.getElementById("root")!)).pipe(Effect.runFork)
Focus the summary and press Enter twice in quick succession:
await page.focus("summary")
await page.keyboard.press("Enter")
await page.keyboard.press("Enter")
What is the expected behavior?
Two presses toggle the fold twice, so it ends closed, as a plain <details> does, and the Model agrees.
What do you see instead?
The second press is lost: the fold ends open, and so does the Model. Over 20 runs each, the fold ended open in 19 in Chromium, 17 in Firefox and none in WebKit. With the presses 16 ms apart, Chromium lost 1 of 20, and at 50 ms none was lost. A single press always held, also with a Model updated by a timer every 4 ms.
Leaving open to the browser (no .open() and no toggle handler) kept every press in the scripted cases below.
Additional information
Here's how we read it, though we may well have misread the host:
- After a
toggle, the host puts the Model's value back on the next animation frame (restoreSooninhtml/internal/dom.ts), and each patch writes controlled properties again (kernel.ts). - When the second press has flipped
openbut itstoggletask hasn't run yet, that write undoes the press. The browser then merges the pendingtoggleinto one whose old and new states match, soupdatenever hears of the press. valueandcheckeddon't have this gap, sinceinputandchangefire inside the gesture.
Scripted, the same thing happens in all three browsers, 0 of 10 runs held each:
- a second
summary.click()lands after the first press'stogglebut before the restore frame; - a
summary.click()is followed in the same task by any message that redraws the component.
Popovers seem to handle this same coalescing: the "auto" mode is followed, and BrowserHost.test.ts covers coalesced toggles. The one details in the tests, in the form fixture, isn't pressed.
Is open on a details meant to be controlled like a field? If so, should the host skip the put-back while a toggle is pending, or follow a details as it follows an "auto" popover? If the intended way is to leave open to the browser, as the DevTools overlay does with h.details.key(...), could the .open() docs say so for details? We've moved to leaving it to the browser, so nothing is blocked on our side.
This was written by Claude Code on behalf of max-sixty
- 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
-
Độ 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
-
`@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
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