Skip to content

fix: keep the resting comment box off a target the margin rail doesn't stand beside - #5512

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-5475-rest
Nov 5, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-5475-rest

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

On a workspace with two panes side by side, a click on the left pane's words shows the resting comment box (#5428) over the right pane's first line. The next click there opens the box instead of reaching the page. This keeps the box off any target with no margin beside it, as #5428 described: "Without room there, as on a workspace page or in a window under about 1340 px, it waits for the press".

Cause. The placement (browser/runtime/annotation-overlay/composing/floating-response.js) withholds the resting box only when its seat is above or below the target. Clicking the pane's words focuses its scroller, so c names the whole pane. The seat on the right has 600 px of room, but that room is the neighbouring pane, not a margin: a workspace keeps no rail, and a pane isn't in the column the rail lies beside (margin-layout.js).

Change. The resting box also waits for c when the rail doesn't stand beside its target. That fact now has one home, railStandsBeside(target) in margin-layout.js, which marginSpot reads too; the box no longer infers it from place.margin, which can be a shown row's rectangle wherever the rail stands. Pressing c still opens the comment box. The module header now says so.

How #5228 relates. The box came after #5228. #5475 bisected the panes test to #5228, which first broke it at userReadingRegion(); #5425 fixed that, and the click then hit this box.

Tests. tests/browser/navigation/test_panes.py::test_a_click_on_a_panes_words_makes_it_the_subject_of_every_scroll_key failed on main and passes with the change. The new test_the_box_waits_for_the_press_beside_a_pane_the_rail_does_not_stand_by covers an empty pane and a pane already showing another comment's pin. The resting-box tests in tests/browser/navigation/test_commenting.py pass, including test_the_box_waits_for_the_press_with_no_room_beside_its_target.

Refs #5475 — automated triage

…t stand beside

The comment box at rest (#5428) waits for `c` when its seat is above or
below its target, because there it would lie on the page's own controls. A
seat to the side passed even where no margin stands beside the target: on a
workspace, a pane whose neighbour fills the window beside it seated the box
on the right, over the neighbour pane's first words, and a click there opened
the box instead of reaching the page.

The placement now also withholds the box when the target has no margin
(`place.margin` is null), as #5428 meant: "Without room there, as on a
workspace page or in a window under about 1340 px, it waits for the press".
Behavior changed: after a click
on a pane's words, no resting box appears over the other pane; `c` still
opens the comment box there.

Refs #5475
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The new !place.margin guard still permits a resting box over a neighboring pane when the target already has a visible comment row. marginSpot() can return that row's rectangle before it checks whether the rail stands beside the target, so place.margin is non-null even with no adjacent rail. Please use the rail-adjacency fact for this decision while keeping existing pin geometry for its other callers, and cover a pane with an existing comment as well as the empty-pane case.

This was written by Codex on behalf of max-sixty

The resting box waited for c where place.margin was null, but marginSpot
returns a visible row's rectangle before it asks whether the rail stands
beside the target, so a shown row would have let the box rest over a
neighbouring pane. margin-layout.js now exports railStandsBeside(target),
which marginSpot also reads, and the resting box decides by it; marginSpot's
geometry for its other callers is unchanged.

A pane test covers an empty pane and a pane already showing another
comment's pin.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Pushed 8586e8a. The rail-adjacency fact now has one home, railStandsBeside(target) in margin-layout.js. marginSpot reads it, and its geometry for the thread card and the editor is unchanged. The resting box decides by railStandsBeside(place.element) rather than place.margin, so a shown row's rectangle can no longer let the box rest where the rail doesn't stand.

On coverage: I couldn't reach the exact case where the resting target has its own visible row. With a comment on the pane itself (anchor: {section: "left-reading"}), clicking the pane's words routes c to that thread, so the box never rests, on the old head or the new one. The new parametrized test_the_box_waits_for_the_press_beside_a_pane_the_rail_does_not_stand_by covers an empty pane and a pane already showing another comment's pin. Both pass here, and both also passed on the previous head. The fix covers your case because of what the guard now reads, not because a test reproduced it.

Locally: that test, the panes click test, the resting-box tests in test_commenting.py, pnpm run check:browser and pnpm run test:runtime all pass.

@leaf-agent
leaf-agent merged commit 5b70457 into main Nov 5, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5475-rest branch November 5, 2026 17:52
leaf-agent added a commit that referenced this pull request Nov 7, 2026
#5428 stands the empty comment box beside the target `c` would open it
on, and its placement header says the box stands only in "the margin
its rail stands in". The code withheld it only above or below the
target and beside a target the rail doesn't stand by (#5512), so a box
seated left of its target, or right of a target that ends short of the
column's edge, stood on the page's own words and controls. Beside an
On me stop inside a tab panel it covered the panel's "Second" tab; beside
an inline suggestion it covered a draft's Edit control; beside a widget
whose value shortened, the solve slid it across the column with no input.

The box now rests only on the rail's side and only where its target
reaches the column's edge (`railEdge` in margin-layout.js, which
`marginSpot` reads too). Elsewhere it waits for `c`, as #5428 already
has it do with no room beside the target; `c` still opens the box there.

Tests that fail on main and pass with this:
- test_a_tally_counts_its_regions_obligations_and_walks_them
- test_g_hints_press_each_visible_page_map_margin_entry
- test_widget_controller_owns_presentation_across_values_and_lifetimes
  [light], [shadow-host], [shadow-child]
- test_page_owned_registry_and_widget_use_the_captured_public_api
- test_an_expanded_diff_file_can_retry_its_failed_chunk_in_place
- test_a_reaction_returns_focus_to_the_visual_target[keyboard], [aim]
- test_a_declared_visual_part_can_raise_the_same_bar_from_the_keyboard
- test_an_aim_at_a_seam_promises_the_element_its_press_takes

Refs #5641
leaf-agent added a commit that referenced this pull request Nov 7, 2026
…umn (#5662)

The resting comment box from #5428 could stand over the page's own words
and controls, which its placement header rules out: the box "stands only
in the room beside what it is about, the margin its rail stands in". The
code withheld it only above or below its target and beside a target the
rail doesn't stand by (#5512). A box seated on the target's left, or
right of a target that ends short of the column's edge, still stood over
the column.

It now rests only on the rail's side, and only where its target reaches
the column's edge. `railEdge()` in `margin-layout.js` gives that edge,
and `marginSpot` now reads it too. Anywhere else the box waits for `c`,
as #5428 already has it do where there's no room beside the target. `c`
still opens the box in every case.

**What changes on screen.** Focus on a target that ends short of the
column's right edge no longer shows the empty box. That covers an inline
link or suggestion, a diagram part, a widget's control, and a question
inside a tab panel. Beside a paragraph, a question or another block that
reaches the edge, the box still rests in the margin.
`tests/browser/navigation/test_commenting.py`, which holds #5428's
behaviours, passes unchanged.

| | Before | After |
|---|---|---|
| On me stop in a side-list tab panel |
![before](https://github.com/user-attachments/assets/3c4afe80-8462-486d-8e24-3931a2dbd4d2)
|
![after](https://github.com/user-attachments/assets/18c420f5-2d8a-4938-a039-51fbe69163f1)
|
| Inline suggestion beside a draft |
![before](https://github.com/user-attachments/assets/3a2e1a28-2d43-472b-8a2e-232397b39588)
|
![after](https://github.com/user-attachments/assets/a03330de-b979-4eb7-8e99-64dafa9e3eec)
|

In the first, the box covers the "Second" tab the user presses next. In
the second, it covers the draft's Edit control.

**Tests from #5641 that fail on main `ec2799b1d` and pass on this
branch** (`--run-main`, run singly):

- `test_a_tally_counts_its_regions_obligations_and_walks_them`: the box
intercepted the tab click.
- `test_g_hints_press_each_visible_page_map_margin_entry`: the box
intercepted the draft's Edit.
-
`test_widget_controller_owns_presentation_across_values_and_lifetimes[light]`,
`[shadow-host]`, `[shadow-child]` and
`test_page_owned_registry_and_widget_use_the_captured_public_api`: when
the widget's value got shorter, a new placement moved the box 29 px with
no input. It no longer rests beside that widget.
- `test_an_expanded_diff_file_can_retry_its_failed_chunk_in_place`
- `test_a_reaction_returns_focus_to_the_visual_target[keyboard]`,
`[aim]`,
`test_a_declared_visual_part_can_raise_the_same_bar_from_the_keyboard`,
`test_an_aim_at_a_seam_promises_the_element_its_press_takes` and
`test_a_picture_in_a_control_stays_the_controls_and_any_other_takes_a_comment`:
#5661 loosened these to accept a resting bar. The box no longer rests
beside a diagram part, an aimed item or a button icon, so the second
commit restores their original assertion that the bar is hidden, and
they pass with it.

<details><summary>Other checks</summary>

- The resting-box and pane tests in `test_commenting.py` and
`test_panes.py` (`-k "rest or box or waits or c_ or press"`): 27 passed.
- `pnpm run test:runtime` (896 pass), `pnpm run check`, and `pre-commit
run --files` on both files: pass.

</details>

Refs #5641 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 8, 2026
#5425 landed the repair this branch sat on, so its focusInPage move and its
wheel test are main's now. passages.js takes main's focusInPage, which #5511
extended to Leaf surfaces seated in the page. reading-regions.js keeps this
branch's chosen region beside main's removal of the local focusInPage.
test_panes.py keeps #5512's resting-box test, the wheel test once, then this
branch's two tests.

Refs #4062
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants