Repository navigation
Show a reveal.js fragment's comment row once the fragment appears - #5042
Conversation
A deck in the reveal.js shape keeps its other slides laid out for their transitions: the next one transparent below the current one, the one before moved out of the deck's clipping box. The test comments on each, plus a closed disclosure as a control, and asserts that only the showing slide's row stands, and that after the deck swaps slides by a transition its rows follow without a reload. On main the transparent slide's row stands over empty space. Part of #5024 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… again as a transition ends
A deck that keeps its other slides laid out for their transitions leaves the
next one transparent below the current one, so its comment's row stood over
empty space. The margin asks one reading whether a target is drawn at all
(`visibleTargetParts`), which already left out skipped content, `display:
none`, `visibility: hidden` and inert content; it now leaves out `opacity: 0`
too, through the same `checkVisibility` that anchor resolution and reading
places already ask with `opacityProperty`. Its other readers (comment
placement, thread destinations, the floating surfaces and the target picker)
take the same answer.
A transition or animation is read where it starts, at the value it leaves:
the class change that fades a slide in, or moves one out of the box that
clips it, runs the margin pass while the slide is still transparent or still
in place, and nothing after it resized or mutated. The row stayed withheld,
or stayed standing, until an unrelated pass, which in the test came about
40 s later. The margin now reads the rows under a box whose transition or
animation ends again, in the same once-a-frame reading a scroll inside a
pane gets, which brings the whole pass only where a row changes answer. The
same gap left a reveal.js fragment's row withheld after the fragment showed.
`targetShown` drops its own `checkVisibility()` on each part, which the
drawn reading's parts already pass.
The test fails on main at the transparent slide, and with the reading
changed but no re-read at the swap: `{'one': False, 'two': True}` two frames
after both transitions end.
Part of #5024
Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
[P2] Refresh floating surfaces when opacity finishes changing. The shared visibleTargetParts reader now excludes opacity-zero targets, but the new completion listeners only refresh margin rows. An unfinished comment has no row to trigger its placement: open a comment, hide its paragraph with opacity 0, then transition the paragraph back to 1. In Chromium at this head, after transitionend and two frames, the paragraph is visible while the editor still has data-lf-withheld, hiding the user's draft. Restoring only the earlier visibility reader makes the same focused check pass; the captures show the difference.
The shared visibility change needs matching invalidation for floating surfaces, including comment editors, when transitions or animations finish. Leaving refresh solely in the margin introduces a dependency on whether another annotation already has a row.
Review found no case the opacity reading answers: under Leaf, reveal.js's slides that aren't showing are `display: none` (Leaf's `[hidden]` rule), in reveal 5.1 and 6.0.2, Chromium and Firefox. It cost a regression: a paragraph shown and faded in with `Element.animate` from opacity 0, as Leaf's own `motion()` does, was read while transparent, and Web Animations fire neither `transitionend` nor `animationend`, so its row stayed withheld. And the at-work bars, which never read `visibleTargetParts`, still drew beside a transparent target. So `visibleTargetParts` is main's again. The margin's re-read as a transition or animation ends stays: it is what lets a reveal.js fragment's row stand once the fragment shows, since the fragment's `visibility` turns visible only after the transition's first frame. The test deck now hides its next slide with a `visibility` transition, as reveal hides a fragment, so it guards that re-read. Part of #5024 Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # dist/kernel/kernel.json
… colours (#5049) Part of #5025, which #5048 closed with `data-style="own"` while this branch was open. A page that takes no theme, such as a reveal.js deck the user brings, kept three of Leaf's restylings: - every table became a block that scrolls its columns, so a table the page sized to `width: 100%` shrank its rows to their content inside a full-width border; - every code block took an 8px float under its last line; - every `pre > code` with a `language-…` class was recoloured, which deleted the page's own token spans. None of the three needs a subtree opt-out. Each was a reading-face rule that reached every page, so this moves each into the face. A page that takes no theme then keeps its own tables and code with no attribute. It also removes `data-style="own"`, which #5048 added hours earlier (see the section on removing it, below). Content with its own design inside a themed page uses the face input instead. ## What changed **The scroll model is now part of the reading face** (`browser/styles/components/reading.css`). Before, it reached every page. The model covers four rules: a table or code block scrolls inside itself, the 8px clearance under it, an identifier breaks anywhere, and paper wraps code. The reading theme turns the face on for the whole page. Leaf's own surfaces (transcripts, rendered Markdown, the chrome, lf-code) turn it on for themselves. So every themed page and every Leaf surface keeps the model. A page without the face keeps the browser's table and pre. Where one of those runs past the window, `page check --render` refuses the page and names the element (`page-scrolls`, `clipped-out`). That check is already in the agent's path (AGENTS.md, "Leaf's role"). No CSS keeps a table scrollable without making it a block. A block box detaches the author's width, border and ground from the table grid inside it. So the scroll model can't stay on a page like this without breaking its tables. **`highlightBlocks` (`browser/runtime/syntax.js`) colours a block only when it holds only text and wears the face.** - A block that holds elements was marked up by its author, so Leaf leaves it alone on every page. Leaf's own spans from an earlier pass still count as text, so a revision that changes the block's language still recolours it. - The token palette is drawn for the face's code ground. On a page without the face it came out as light-scheme ink on the page's own dark ground (see the before shot). - A block that isn't in the document yet has no face to read, so it is coloured. That keeps a message coloured when Leaf draws it before placing it. **The breakout rule for a table in a Layout** (`browser/layouts.css`) is split in two. Its scroll container, its column-wide minimum and its inline-block caption assumed the face's block table, so they now apply only under the face. On a native table the caption rule would have pulled the caption out of its caption box. Its max-content width, start alignment and `contain: none` apply with or without the face. Otherwise a `data-width="wide"` table on a no-theme page took the breakout's `inline-size: 100%`, which spread two one-word columns over a 908px track. With the fix the table measures 120px, in Chromium and Firefox. A new render test covers it, using `serve(theme=False)`. The shipped references now say that the scrolling of wide tables and code blocks, identifiers breaking inside cells, and code colouring hold only under the face: `package-themes.md`, `module-reading.md`, `page-authoring.md` ("Markup" and "Style the page"), `page-layout.md`, and the core registry's `table` entry. A page without the face is sent to a box of its own that scrolls sideways (`overflow-x: auto` with `class="scroll"`). The `past-column` finding offers that box too, beside `data-width`, because `data-width` doesn't help a native table that is wider than a narrow window. ## Evidence The issue's repro was a no-theme page holding a `width: 100%` table, a YAML block the page highlighted itself, and a plain YAML block. I read it through `leaf-dev probe` against a page served by `bin/leaf server start`: | | before | after | | --- | --- | --- | | table display / row width | `block` / 117px of 720 | `table` / 718px | | page's own token spans kept / Leaf's spans | 0 / 4 | 4 / 0 | | plain block recoloured | yes | no | | pre height (content and padding: 72px) | 80px | 72px | `tests/browser/test_plain_pages.py` now also compares the size of every box the author wrote inside `body`. All three restylings had left every property the author declared computing the same, so the old comparison missed them. A new fixture, `tests/fixtures/plain/deck.html`, holds the issue's pattern. Against the base CSS and runtime, the test fails on: - `deck`: colours, added spans and sizes; - `article`: its own `width: 100%` table is drawn 291px wide instead of 687; - `dashboard`. With this change, all three pass. ## What this changes for plain pages The dashboard fixture has a six-column table that is wider than a window under 760px. Leaf used to scroll it inside itself. Now the gate refuses the page at those widths, as it refuses any page that scrolls sideways, because the live root clips sideways overflow. The fixture's pin moves from the `scroll-clearance` obstacle to a new one, `sideways-clip`. A page author meets the same refusal on a wide table and answers it in the page's own CSS. The size comparison also found two older departures, pinned as `class-vocabulary`. An author's `dl.facts` takes the facts list's grid, and an author's `.choice` takes a choice target's aim floor, because Leaf owns both class names on every page. This PR doesn't change either. ## Removing `data-style="own"` #5048 landed this attribute through automated triage while this branch was open. After the root fix above, it no longer earns a second API for one capability (root `AGENTS.md`, "Fix the underlying issue"): - On a page that takes no theme, it changes nothing, because nothing it excludes reaches that page any more. - On a themed page, it removes only part of what the face input does. A probe of the repro under the reading theme with `data-style="own"` on `main` still read the face's 18px table margin, its sans table font and its muted 13px headings. - `--lf-reading-face: initial` on a box takes the whole face from the markup inside it. It works on a wrapper only: each face rule reads the element's parent, so the box that sets it still wears the face. Set on a table itself, the table stays a block with the face's margin and font. `package-themes.md` says to put it on a wrapper. `initial` is the value Leaf's own `:host` rule uses to take the face away. `package-themes.md` ("Personal themes") now documents it beside `1`. The attribute had been on `main` for hours and no page uses it. This branch deletes its selector exclusions in `reading.css`, its check in `syntax.js`, its feature-gallery section and stills state, and its plain fixture; `deck.html` holds the same pattern with no attribute. #5048's test becomes `test_a_box_off_the_reading_face_keeps_its_own_tables_code_and_comments`. #5048 tested the attribute on a section, a table and a pre. The new test covers the wrapping section only, the one placement where the face input works. The paragraph #5048 added to `page-authoring.md` becomes one sentence pointing at the face input. I kept that sentence because the theme-inputs table in `packages.md` lists only `--lf-reading-face: 1`, so an author embedding a design wouldn't learn how to turn the face off. Before deleting it, I proved the replacement on a themed page with a `--lf-reading-face: initial` section and a comment seeded inside it (`leaf-dev probe --log`). The `width: 100%` table stayed native at 680px of 688. The page's token kept rgb(160, 20, 80) with no Leaf spans. The block had no `::after` and a plain block stayed uncoloured. The comment's mark landed on the token. The code block outside the section stayed coloured, with its clearance. The converted test fails when the section sets `1` instead (`display` reads `block`). ## Calls Max may reverse - **`data-style="own"` is removed** in favour of the face input (above). Reverting commit `344523293` restores it. - **The scroll model leaves pages without a theme.** The other option is a runtime that marks a table whose grid is wider than its box, with the core making only marked tables into blocks. That keeps wide tables reachable without any CSS from the author, but it adds a per-table observer and a switch one frame late on first paint. I didn't build it, because the gate already reports the case to the agent. What keeps such a table out of reach on a no-theme page is Leaf's root rule `html[data-lf-live] { overflow-x: hidden }` (`browser/base.css`). On a 390px window the table's last cell stays at 715px and the wheel moves the page 0px. With the rule lifted, the wheel moves the page 582px and the cell comes into view. Removing that rule is a separate decision, put to Max on his page, and not part of this PR. Removing it alone would not unblock such a page either, since the render gate still refuses a page that scrolls sideways (`page-scrolls`). - **Code colouring follows the face.** A page without a theme that wants Leaf's colours sets `--lf-reading-face: 1` on a box around the code. ## Checks run - The test `test_plain_pages`, on every fixture by `-k`: 6 passed and 3 xfailed with the new pins. Against the base CSS, `deck`, `article` and `dashboard` failed. - In `test_render_anchors`, `-k "marked_up or rewritten_while or aliases or colored_without or code_copy"`: 12 passed. This includes a new test, `test_a_block_its_author_marked_up_keeps_its_markup`. - In `test_render_gate`, `-k` covering scrollbar clearance, scrolling tables, the squeeze reading, the syntax probe and table widths: 14 passed. - Thread message colouring: `test_an_agent_message_edit_updates_the_panel_and_its_inline_thread` and `test_a_reply_renders_the_markdown_it_was_written_in` both passed. - `pnpm run test:runtime`: 737 passed. `pnpm run build:browser` regenerated the kernel. - `leaf-dev stills 2a9d00d` captured 57 states, reading 33 of the catalogue's 34 source pages at least once, with extra table, code-block and thread states. Neither pixels nor computed styles changed in any of them, except for noise. The three About states differ in the diagnostic text they print, with no style difference. `on-me` differed once, inside a closed disclosure whose widget had upgraded in only one arm, and was unchanged on a rerun. The 34th page's state, `thread-choice-hints`, times out on both arms. I stopped the full 328-state run because the machine's load stood at 60–90 and the run would have taken hours. - The repro and a themed copy of it in Firefox through `leaf-dev probe --browser firefox`: the same readings as Chromium. Without a theme, all three restylings are gone. With the reading theme, the page's own highlighted block keeps its spans, and the plain block, the table's scrolling and the clearance are as before. - After merging `main` and removing the attribute: the syntax tests with the converted face-input test (13 passed), every plain fixture (6 passed, 3 xfailed), `test_page_fixtures_pass_check` on the feature gallery, the gate and thread selections (16 passed at the first merge), and `test:runtime` (737 passed). Before the removal, `leaf-dev stills origin/main` showed `native-code`, `table-scrolled-phone`, `breakout-captions` and `thread-code-copy` unchanged. The 57-state reading above was taken before either merge. - Review fixes (`5e656b671`): the table, face and syntax selections in `test_render_gate` and `test_render_anchors` (18 passed), every plain fixture (6 passed, 3 xfailed), `tests/model/test_render_gate.py` (9 passed), `pnpm run check:browser`, and `leaf-dev stills 38eacfe` on `breakout-captions` (three states), `gallery-wide-schedule`, `table-scrolled-phone` and `on-me`. All were unchanged except `on-me`, which showed the same timing noise in a closed disclosure, with no change to its table. - After merging `main` again (#5042 and later) and scoping the registry's identifier advice (`fef592879`): `pnpm run check:browser` passed, and `test_render_gate`'s table, caption, breakout and clearance selection passed, 15 tests including the new breakout test. ## Not verified - WebKit ran the issue's repro and the wrapper case in the independent review of the previous head. It has not run the no-theme breakout table fix (`layouts.css`) or anything later. - The 270 catalogue states beyond the 58 tried. They share their source pages with states that were read, and the computed-style lists read every element on the page. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
In Firefox, every box Leaf anchors to content inside a scaled box stood away from what it marked: comment pins and rows, the thread card, the Alt outline, Go-to chips and Copy. reveal.js translates and scales its `.slides` box to fit its stage, so marks on a deck's slides hit this. A scroll inside a scaled box, such as the long `pre code` reveal's theme makes a scroller, then carried rows off their words in Firefox and WebKit. An agent found the first while working on #5024, and #5042 recorded it as the part of #5024 that PR left open. Part of #5024 ## The cause Firefox resolves `anchor()` and `anchor-size()` against the box layout gave the anchor, leaving out every transform on it and its ancestors: Playwright's Firefox 157, and release Firefox 159. It keeps CSS zoom. Chromium 156 and WebKit 27.2 read the transformed bounding box. `anchorBox` (css-anchors.js) is the one measurement every anchored inset starts from. It corrected only translations, added for widened tables in #3113; where an ancestor scaled or rotated, it kept the box as shown. A scroll inside a scaled box is a separate gap. Firefox 157 and WebKit 27.2 carry an anchored box by the scroll's layout pixels, not the smaller or larger distance the words move on screen. Chromium 156 follows the words. Firefox's bug is 2055371, and it remains with Firefox's own transform support on. ## What changed **`anchorBox` reads the laid-out box where the engine drops transforms.** Each box from the anchor up to the outermost transform stands at its offset from its offset parent's laid-out box (`laidOut`). The walk ends at the first box no transform moves, whose client rectangle is exact. One walk covers translation, scale, rotation and nested transforms, and it replaces the translation-only path (`translationOf`, `movement`). A scroller's first words or an SVG drawing has no offsets, so it maps through its nearest HTML box in proportion, which holds for a translation or a scale. Other engines take the early return they took before. That includes Firefox Nightly 160 with `layout.css.anchor-positioning.follows-transforms.enabled` on, since `anchorDropsTransforms()` then finds transforms kept. **Block controls add the size difference.** Copy, a heading's link and a recording's bar read their block's far edges and size in CSS (`anchor(right)`, `anchor(bottom)`, `anchor-size(width)`). A scale moves those differently from the corner, so `readInsets` also writes `--lf-block-control-dw` and `-dh`, which those three rules add. Both are zero except in Firefox under a transform, so other engines write nothing new. **The margin runs a pass when a scroll inside a scaled box ends.** The margin already hears every scroll in capture. It now also hears `scrollend`, and runs a pass where a row's carrier is anchored inside the box that scrolled and that box shows a layout pixel as more or less than a screen pixel (`scrollMisplacesAnchors`: its on-screen width differs from `offsetWidth` × `currentCSSZoom`, so a CSS zoom, which anchors follow, doesn't count). WebKit 27.2's Linux build (Playwright build 2370, which CI runs) has no `currentCSSZoom`, unlike its macOS build of the same number, so a missing zoom counts as 1: a zoomed box there reads as scaled and costs one pass that leaves the rows where they stood. Rows drift while the scroll runs and stand on their words a frame after it ends. The check reads the box's scale on screen rather than the engine, so it covers WebKit, which `anchorDropsTransforms()` doesn't flag. In Chromium, where it runs, the pass also moves a row whose carrier scrolls with something its target doesn't back to where a fresh pass puts it: review found a pin on a `pre` whose `code` scrolled carried 45px with the code without the pass, a mismatch older than this PR, and the pass snaps it back to the block's corner. The css-anchors.js header, which rejects a script that places boxes again after each scroll, now says where this pass runs and why. **`notes/browser-support.md`** rewrites "An anchor's transforms in Firefox": the engines, bugs 2059840 (the pref, on in Nightly 160) and 2059841 (enabling it in release: no milestone, blocked on 2055371, 2057633 and 2060883), the inner-scroll gap, and when to delete each part. ## Evidence Real reveal.js 5.1 (vendored into `.tmp/` for the probe only) in a `layout-workspace` page at 1280x800, `leaf-dev probe --browser firefox --base`: the quoted comment's pin stood at `[974, 913]` on the merge base, 315px below its passage and outside the window, and stands at `[714, 566]` on this branch. Chromium puts it at `[714, 567]`. Review drove the same deck in Firefox 157 through slide changes, resizes, narrow windows and reveal's overview mode (scale 0.19, 3D transforms), and every mark landed within 1–3px of Chromium. A fixture with the same transform at 0.6 (`translate(-50%, -50%) scale(0.6)`), at 1440x900, each mark's top-left corner: | Mark | Firefox, merge base | Firefox, branch | Chromium | | --- | --- | --- | --- | | Quoted comment's row | 1126, 549 | 1126, 287 | 1126, 287 | | Copy | 1592, 624 | 944, 329 | 944, 329 | | Heading link | 748, 489 | 436, 244 | 436, 244 | | Alt outline | 780, 539 | 468, 277 | 468, 277 | | Link's Go-to chip | 801, 572 | 477, 293 | 477, 293 | | Thread card | 1220, 533 | 908, 270 | 908, 271 | A scroll of 60px inside a box scaled to 0.6, holding the quoted words, measured as the row's offset from its words after `scrollend`: Firefox moved from 0 to −24px and WebKit from 0 to −24px with no pass after the scroll; with the `scrollend` pass all three engines stay at 0, after one pass each. `test_marks_stand_on_a_scaled_slide_in_every_engine` (tests/browser/margin/test_scrollers.py) runs in Chromium, Firefox and WebKit. On a slide translated and scaled to 0.6, the quoted words stand in a scrolling box holding only words, so the row anchors to the box's first words and exercises `anchorBox`'s proportional mapping. The test holds the row level with its words through a 120px page scroll, then through a 60px scroll of that box, after `scrollend` and without announcing a layout change, and checks that the Alt outline stands on the box and Copy inside its block's corner. On the merge base it fails in Firefox, with the row 257px below its words. With `anchorBox` fixed but no size insets, it fails at Copy, 380px past the block. With the `scrollend` listener disabled, it fails in Firefox and WebKit, each row 24px off. Its outline and Copy assertions, shared with the widened-table test, move into one helper. Cost: in Firefox, timing copies of both versions on the fixture's DOM, one `anchorBox` call took 2.4 µs against 3.0–3.3 µs on main for an anchor under no transform, and 5.1–6.2 µs against 3.3–3.6 µs for one in the scaled box, where main returned the wrong box. A margin pass makes one call per carrier, frame level and shown control. In every engine, a scroll's end checks the margin's carriers against the box that scrolled, reads that box's width only where one stands in it, and runs one margin pass only where the box is scaled by a transform, not a zoom. Under `zoom: 0.6`, a 60px scroll in the slide ran no pass in any of the three engines and the row stayed on its words; with one comment elsewhere on the scaled slide, scrolling the box beside it ran no pass in Firefox. Before/after screenshots are in the worktree's `.tmp/evidence/` (`firefox-*-before.png`, `firefox-*-after.png`, `chromium-*.png`). ## What remains - While a scroll inside a scaled box runs, Firefox and WebKit carry its rows by the scroll's layout pixels; they stand on their words a frame after it ends. Only the margin's rows are placed again then; other marks anchored inside the scrolled box, such as Go-to chips raised before the scroll, were not checked after one. - Offsets are whole pixels, so a mark in Firefox can stand up to a pixel off (the thread card above). - Inside a rotated box, a mark anchored to an SVG drawing or a scroller's first words stands off by the rotation. - Once bug 2059841 ships in release Firefox, the offset walk and the size insets can go. The `scrollend` pass can go once release Firefox and WebKit both keep a row on its words through that scroll. The test passes whatever the engines do while the pass is in place, so recheck with the `scrollend` listener removed (Firefox 157 left the row −24.1px from its words that way, WebKit 27.2 −24.0px), or by reading the row in the frame after the scroll, before `scrollend`. ## Calls Max may reverse - The laid-out box comes from offset chains rather than composing `DOMMatrix`es from computed transforms. Offsets already leave transforms out, so one walk handles every transform kind without parsing `transform`, `translate`, `rotate`, `scale`, origins or perspective; the price is the whole-pixel rounding above. - Block controls get two more custom properties rather than staying off by the scale on a scaled block. - The `scrollend` pass keys on the scrolled box's scale on screen, not on `anchorDropsTransforms()`, because WebKit drifts the same way and keeps transforms at rest. Chromium pays one pass at the end of each scroll inside a scaled box that carries a row. ## Checks run - `uv run pytest tests/browser/margin/test_scrollers.py -k "scaled_slide or widened_table or every_engine or pane or slide_the_reader or carrier" -n 2`: 16 passed, all three engines of both transformed-box tests included, after merging main at a300990 (which brought #5042's stir reading beside the new listener). Evaluated in Playwright 1.64.1's Linux browsers (Docker), the check reads a `scale(0.6)` scroller as scaled in WebKit, Chromium and Firefox, where WebKit read it as unscaled before the `?? 1` default; CI's WebKit case had failed that way, the row 24px off. With the `scrollend` listener disabled, the scaled-slide test fails in Firefox and WebKit. - Firefox and WebKit cases of `test_tabs.py`, `test_rings.py`, `test_focus.py`, `threads/test_layout.py`, `test_comment_marks.py`, `test_render_drawing.py`, `test_suggestions.py`, `test_send_corner.py`, `test_render_pages.py` (`-k "firefox or webkit" -n 2`): 43 passed, 2 failed. The two are `test_words_scrolled_past_a_card_head_show_nowhere_above_it[firefox_browser-*]`, which fail the same way with current main's `browser/` and `dist/` (`travel` 246, wants over 300). - Chromium tests for Copy, heading links and anchors (`test_render_heading_links.py`, `test_render_code_reading.py`, `test_render_anchors.py`), run before the `scrollend` commit: 109 passed. Eight failed and four errored, all in `test_render_anchors.py`: `test_thread_travel_keeps_its_passage_above_the_bottom_reading_clearance` and the `lf-diff` cases (`deferred_diff_renders_only_opened_files`, `native_file_metadata_without_empty_disclosures`, `inline_version_diff_indexes_astral_text`, `hunk_step_waiting_on_a_file`, which throw `Cannot read properties of null (reading 'path')` in `lf-diff.js`). The same eight fail and the same four error with main's `browser/` and `dist/` at 1f49b64. - `pnpm run test:runtime`: 742 passed. `pnpm run build:browser` (type check and kernel rebuild), `pnpm run check:browser`, pre-commit on the changed files. ## Not verified - A recording's bar and a heading link's far-end placement on a scaled block were not driven; their CSS takes the same size inset as Copy, which was. - A box-motion animation that scales an anchor's ancestor mid-motion. - A real trackpad scroll inside a scaled `pre code`; the test and probes scroll by setting `scrollTop`. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 <[email protected]>


A comment on a reveal.js fragment now gets its margin row as soon as the fragment appears. Before, the row stayed withheld after the fragment showed, until some unrelated layout pass happened to run.
Why the row stayed withheld
reveal.js hides a fragment still to come with
visibility: hiddenand shows it by adding a class that starts a transition. The margin runs its pass when that class changes. At that moment the transition hasn't started, andvisibilityturns visible only after the transition's first frame, so the pass reads the fragment as hidden and withholds its row. Nothing afterwards resizes or mutates, so nothing runs the pass again. The same timing affects a slide moved out of the box that clips it by a transform transition: its row keeps standing after the slide has gone.What changed
The margin now treats
transitionendandanimationendon page content as it already treats a scroll inside a pane. Once a frame, it reads again whether the rows under the box whose transition or animation ended have somewhere to stand, and runs the whole pass only where a row's answer changed (margin-layout.js,hearTargetChanges). This is the existing scroll re-read, renamed fromscheduleScrollReadingtoscheduleStirReading. It filters on whether a row's target sits under that box, not on a list of properties, so the fragment'svisibilityand the slide'stransformare both covered. Leaf's own chrome is skipped.targetShownalso stops callingcheckVisibility()on each part, since every partvisibleTargetPartsreturns has already passed a stricter check.What #5024 described
The issue blames reveal.js slides that keep the
hiddenattribute while staying laid out. That didn't reproduce. Under Leaf, those slides compute todisplay: none, because Leaf's[hidden]:not([hidden="until-found"]) { display: none !important }(base.css) beats reveal's inlinestyle.display = "block", so their rows were already withheld. In Firefox, the showing slide's pin and at-work bar reproduce the issue's picture, misplaced by reveal's scaled.slidesbox (#5058, open). Hence Part of #5024.Evidence
test_rows_follow_slides_a_transition_shows_and_hides(tests/browser/margin/test_scrollers.py) uses a deck whose next slide is hidden by avisibilitytransition, as reveal hides a fragment, and whose previous slide moves out of the deck's clipping box. A closed disclosure on the same page is the control. With the re-read reverted, it fails two frames after both transitions end, with{'one': False, 'two': True}: the gone slide's row still stands and the shown slide's row is still withheld. With the re-read, it passes.leaf-dev probe --basestepsnext()twice. On main the fragment's row stays withheld after the fragment shows. On this branch it stands, and it is withheld again once its slide becomespast.Element.animate, which fires neither event, behaves the same on main and on this branch: its row stands 1.5 s after the fade.Checks run
uv run pytest tests/browser/margin/test_scrollers.py tests/browser/margin/test_card_placement.py tests/browser/margin/test_opening_threads.py tests/browser/margin/test_pins.py tests/browser/test_render_aim.py -k "slides_a_transition or withheld or inactive_tab or escapes or clip or quoted_passage_scrolled or pane or shadow or widened_table or constrained_target or user_scrolls or keyboard_arrival or carries or carried or hidden or closed_tab or observes_visibility": 67 passed, including the scroll re-read's cases in Firefox and WebKitpnpm run test:runtime: 739 passedpnpm run build:browserandpnpm run check:browserafter merging mainNot verified
Element.animatefire neither event, so one that changes a target'svisibilityor moves it out of a clip isn't re-read.