Repository navigation
Stop deferring authored top-layer UI at startup - #904
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
PRESENTATION_PROPERTIES in skills/leaf/scripts/leaf/styles.py still lists interactivity, opacity, and pointer-events beside display, visibility, and all. Those three were the top-layer withholding trio this diff deletes: after it, interactivity appears nowhere else in the tree, and neither opacity !important nor pointer-events !important backs any declaration in the page's own cascade — git grep -E '(opacity|pointer-events|interactivity)\s*:[^;{]*!important' on the head finds only the MCP App shell, a separate document an authored page's inline style cannot reach, and the gate's own test. What the anonymous first layer still declares is visibility: hidden !important in theme.css and SHADOW_STARTUP_CSS, plus the display: none !important rules in chrome.css and the print block.
So version check and check_markup go on refusing a page, or an agent's message markup, for style="opacity: 1 !important" with makes protected presentation property opacity important — naming a protection nothing now provides. The diff also removes the one sentence that said why those three were on the list, theme.css's "Inline importance ranks higher still, so the version gate refuses it on the protected top-layer properties below", so what is left is an unexplained list rather than the same list left as easy to fix as it was found.
Trimming the set moves test_check_rejects_inline_importance_over_the_presentation_boundary, which asserts on opacity specifically, onto a property that stays protected. Happy to push that here if you'd rather it land with the removal than after it.
… rows, and move six nightly tests onto #894 and #895 (#910) `ci` on `main` went red at b7bd021 (#904): [`lint` and `test` passed, and the complete suite in `nightly` failed on eleven cases](https://github.com/max-sixty/leaf/actions/runs/35670525383). One is fixed on today's `main` by e291a95, four are #903's and still open, and this PR is the other six. None of them is #904's. They come from two features that landed earlier the same day and were validated against the everyday gate rather than the nightly selection, so the first run to reach them was this one. **#894 made the command reference dismiss the popover it is opened over. Three cases still assert the restoration it removed.** Opening the reference now follows the platform's modal transition: auto popovers close and are not rebuilt. `test_the_version_menu_is_worked_by_pointer_and_key`, `test_the_versions_menu_suspends_the_pages_own_keys` and `test_a_row_the_platform_activates_names_both_of_its_keys` each ran the reference round trip mid-case and carried on working the menu behind it. They now assert the dismissal where they asserted the return, and stand the menu up again through `open_versions` where the rest of the case needs it. The pair of boundary rows in the third case needed the runtime instead, and is the second fault below. **#895 hoisted a thread's first message head out of the message and onto the card. Two cases still read it from the message.** `ThreadView` renders `messages[0].header` into a `.lf-thread-root-meta` row that carries the thread's Resolve beside the author, so `.lf-edited` and `.lf-conversation-head` are no longer inside `.lf-conversation-msg`. `test_an_agent_message_edit_updates_the_panel_and_its_inline_conversation` read the edit disclosure from the message node on both surfaces and found nothing; it now reads it from the card holding that message. `test_the_margin_groups_meanings_at_one_destination_without_moving_the_page` resolved the head to `null` and raised on its box. Its selector now names the row, which is what has a box — the head itself is `display: contents` there, so keeping the old selector shape would have left that assertion reading zeros and passing vacuously. **#895 moved `--thread-card` from 460px to 380px. One case's viewport was tuned to 460.** `test_a_thread_beside_its_cluster_takes_the_room_to_the_visible_edge` is the narrowing case in a ladder of three: at 1440 the rail used to fall a few pixels short of the card's measure. Against 380 it leaves 453px of room, so the card takes its preferred width with room to spare and never reaches the visible edge. The case runs at 1220 now, where the room is 343px, and asserts that arrangement against `--thread-card-min` and `--thread-card` before it asserts the outcome — so the next move of either token reddens the premise and names the width to re-pick rather than reading as a layout regression. **One fault in the layer: the card's Dismiss lost the row it shares.** Before #895 the margin preview's thread head was absolutely positioned at `inset-block-start: 12px`, the same inset as the card's own head, and Resolve and Dismiss sat on one line. #895 replaced it with the sticky `.lf-thread-root-meta`, which starts inside the thread's own 4px of padding, while the card's head stayed at 12px — so the two icon actions in that corner are 4px out. The stylesheet still states the arrangement they are meant to keep (`The retained settlement action is positioned against the card, alongside Dismiss`), and the nightly case is the reading of it. The head now starts at the card inset plus that padding, so Dismiss lands on the row Resolve rides; the comment beside it is updated to say which of the two is positioned against which, since #895 reversed that. **A second fault: the versions menu's two Tab rows can no longer be read anywhere.** `version.leave-forward` and `version.leave-backward` declare `when: () => atVersionBoundary(…)`, which compares `document.activeElement` against the menu's stops. That is a dispatch question — the press closes the menu only from the end it is held to — and since #894 the reference asks it of a menu the modal has just dismissed, so it answers no for both and the catalogue drops them. They are the only rows in `In the versions menu` that vanish: the other seven stay, each with `data-lf-available="false"`, which is the reading `test_reference_accepts_native_popover_dismissal_across_modal_entry` already asserts for `version.open-v*`. `?` is the only door into the reference and it always dismisses the menu, so no scene is left in which either row can be read, and the shortcut bar names only the one direction the reader can take from where they stand. Both rows now carry `commandReferenceWhen: () => true`, the hook `command-reference.js` offers for this exact split and that its own rows and `margin-projection.js` use, and the third case asserts both directions again, each marked unreachable. ## Verification The six cases pass on this branch and all six fail on `main` without it, along with the neighbouring short-rail case the narrowing one shares its fixture with. Run whole under `--run-nightly` on this head: `tests/test_render_anchors.py` 93 passed; `tests/test_render_navigation.py` and `tests/test_render_controls.py` together 240 passed with one failure, `test_every_shadow_the_layer_lifts_a_box_with_is_cast_in_the_scheme_s_own_ink`, which is #903's; `tests/test_render_margin.py` 125 passed with one failure, `test_a_forced_inline_thread_keeps_its_control_inside_the_margin_budget`, which is #903's too. `tests/test_render_widgets.py` was 179 passed before the reference commit, which does not touch it. `npm run test:runtime` is 33 passed, and pre-commit is clean on the changed files. The reference reading was measured directly in a browser both ways: without the row change the version scope shows seven commands and neither boundary row; with it, nine, both boundary rows reading `data-lf-available="false"` beside `version.open-v1` and `version.open-v2`. PR CI's `lint` and `test` do not reach any of these cases, since the nightly selection is what holds them. <details><summary>Attribution, and what this leaves</summary> **Attribution.** Each failure was placed by running the case against the runtime and tests at the commits between the two nightly runs. The three versions-menu cases fail with #904's assets reverted to 517c4c2, so #904 is not their cause; 1888c6e (#894) is, and its own diff moved `tests/test_render_navigation.py` and `tests/test_render_controls.py` onto the new contract while these three sat in a third file. `git show 39d9cad -- skills/leaf/assets/theme.css` is the `--thread-card` move, and `git log -S externalHeader -- skills/leaf/assets/runtime/conversation/messages.js` returns 39d9cad alone. **The measured geometry.** The narrowing case needs the width left for the card — the gap between the cluster and the visible edge, less the 8px either side — to fall between `--thread-card-min` and `--thread-card`. Measured on the gallery, that width is half the viewport less 267px while the viewport is at or above 1160, below which the rail's own breakpoint moves it: 453px at 1440, 373px at 1280, 343px at 1220, 313px at 1160, and 148px at 1120. The two tokens leave a window from 1174 to 1294, and 1220 sits near its middle. On the alignment fix, Dismiss and Resolve read `top: 523.3` and `527.3` before and `527.3` for both after. **Not in this PR.** Four of the run's eleven belong elsewhere. `test_a_widgets_native_control_names_the_press_the_platform_makes` was repaired on `main` by e291a95, which renamed it; the other four — the elevation shadow, the printed-page word, the widget-root projection and the forced inline thread's margin budget — are #903's, which is open and based on 5854f06. That PR also rewrites the case e291a95 has since replaced and drops the `NATIVE_CONTROL_PAGE` fixture `main` still uses, so it needs a look at `main` before it lands; noted on that thread. **What produced all six.** Both features changed a contract that the everyday gate does not reach and the nightly selection does, and both were validated against the gate that runs before merge. Nothing here changes that; it is the same shape #903 names, one nightly run later. </details> --------- Co-authored-by: leaf-agent <[email protected]>
Leaf used to monkey-patch every authored dialog and popover so startup could defer or hide it until the first semantic presentation. No bundled package opens top-layer UI during startup, so this removes that speculative behavior and makes the browser's native lifecycle authoritative.
Programmatic openings still register with the keyboard layer stack, now in that stack's own module. The package contract requires top-layer UI to open after presentation or from a reader gesture.
The authoring gate now reserves only the display and visibility properties the remaining presentation boundary uses; the overlay-only opacity, pointer-event, and interactivity protections are gone too.
Validation: all 92 startup browser tests, runtime tests, focused native-layer navigation tests, and pre-commit pass. The one failure in the broader navigation run reproduces on the exact
mainSHA with identical geometry.