You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Restore reply focus when a responsive target reappears #3558
test_open_draft_retains_words_when_responsive_layout_hides_its_target[True] fails on current main: after a 480 px viewport hides #bg-contents a and a 1200 px viewport shows it again, the reply draft and its editor return, but the editor is no longer focused. The original responsive draft change specifically intended to retain focus and caret through this cycle.
Reproduce with uv run pytest -q 'tests/journeys/test_render_aim.py::test_open_draft_retains_words_when_responsive_layout_hides_its_target[True]'. The failure takes about 10 seconds locally. The editor still contains A reply about #bg-contents a and has a visible bounding box at the end.
Tracing thread-preview.js shows that placeThreadPreview saves a focus hold for the preview editor when the target hides. Before the target returns, a different reply editor receives focus outside the preview. The focus placement count advances, so the saved hold correctly declines to restore the older editor when the preview becomes visible. The missing behavior appears to be a handoff between the live reply's views when the target returns, rather than a change to the shared focus guard. Diagnostic code was removed from the checkout.
I reproduced the failing journey on current main. The reply retains its words and focus, but focus moves to the floating panel’s reply field while the target is hidden. After the target returns, both reply views are visible and the panel field remains focused. The assertion checks only the preview field, so it reports this as lost focus.
The preview placement saves a focus hold, and the shared focus rule declines to return to it after another placement. That prevents a resize from taking focus away from the panel field the user can currently type in. The remaining product decision is whether returning the target should move the active reply back to its page card or keep the panel editor active; the current test requires the former. I left the issue open and made no focus-rule change pending that choice.
Activity
leaf-agent commentedon Oct 22, 2026
I reproduced the failing journey on current
main. The reply retains its words and focus, but focus moves to the floating panel’s reply field while the target is hidden. After the target returns, both reply views are visible and the panel field remains focused. The assertion checks only the preview field, so it reports this as lost focus.The preview placement saves a focus hold, and the shared focus rule declines to return to it after another placement. That prevents a resize from taking focus away from the panel field the user can currently type in. The remaining product decision is whether returning the target should move the active reply back to its page card or keep the panel editor active; the current test requires the former. I left the issue open and made no focus-rule change pending that choice.