The selection bar sits in its pane in the panes view, so what covers the pane covers it

A pane peeking over it, or a column sliding over its pane, now covers the bar instead of the bar
floating on top. It is placed from the pane's box and still follows the words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-16 20:37:04 -05:00
1 parent bc9557abec
commit 66d25eea7f
3 files changed
+14 -4

No files matched your search

+2
View File
@@ -535,6 +535,8 @@ export function App() {
const click = (e: MouseEvent) => {
if (store.mode === "edit") return;
const target = e.target as HTMLElement;
// The selection bar sits in its pane in the panes view: its own buttons act.
if (target.closest(".selbar")) return;
// A ⋯ (a row's, a pane's, the page's, a note's): its menu, for what it is on.
const more = target.closest<HTMLElement>("[data-more]");
if (more) return void menuAt(more, more);
+10 -4
View File
@@ -8,6 +8,7 @@
* anything), then shows the menu for what is focused.
*/
import { Fragment, type ComponentChildren } from "preact";
import { createPortal } from "preact/compat";
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
import { docOf, isLibraryRoot, label, staleness, type NodeId } from "../core/model";
import { plain } from "../core/text";
@@ -404,10 +405,12 @@ function placeBar(el: HTMLElement | null, shown = false) {
const below = first.top - h - 9 < bar + 4;
const top = below ? last.bottom + 9 : first.top - h - 9;
const mid = (left + right) / 2;
const x = Math.round(Math.max(8, Math.min(window.innerWidth - w - 8, mid - w / 2)));
// In the panes view it is set in its pane (so whatever covers the pane covers it), placed from the pane's box.
const host = el.parentElement?.classList.contains("pane") ? el.parentElement.getBoundingClientRect() : null;
const x = Math.round(Math.max((host?.left ?? 0) + 8, Math.min((host?.right ?? window.innerWidth) - w - 8, mid - w / 2)));
el.classList.toggle("below", below);
el.style.left = `${x}px`;
el.style.top = `${Math.round(top)}px`;
el.style.left = `${x - (host?.left ?? 0)}px`;
el.style.top = `${Math.round(top - (host?.top ?? 0))}px`;
el.style.setProperty("--tick", `${Math.round(Math.max(10, Math.min(w - 10, mid - x)))}px`);
// Scrolled out of its pane or the window: out of sight with it.
const clip = sels[0].closest(".pane-scroll")?.getBoundingClientRect();
@@ -449,11 +452,13 @@ export function SelBar() {
if (!on) return null;
const c = selCtx();
const groups = barItems(c, act);
// In the panes view, inside the pane holding the selection: covered with it by what covers it.
const host = store.panes && !docked ? document.querySelector<HTMLElement>(`.strip .pane[data-tid="${store.branchNodes[store.paneAt]?.id}"]`) : null;
const go = (it: Item) => () => {
hideBar();
it.run();
};
return (
const bar = (
<div class={`selbar${docked ? " docked" : ""}`} role="toolbar" aria-label="Ask about the selected words" ref={ref} style={docked ? undefined : { visibility: "hidden" }} onMouseDown={(e) => e.preventDefault()} onContextMenu={(e) => e.preventDefault()}>
{groups.map((g, i) => (
<Fragment key={i}>
@@ -485,6 +490,7 @@ export function SelBar() {
)}
</div>
);
return host ? createPortal(bar, host) : bar;
}
// ---- key hints as buttons ----
+2
View File
@@ -816,6 +816,8 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid
:is(.sidenote, .inset) > .more { position: absolute; top: 0.15rem; right: 0.15rem; margin: 0; font-size: 0.82rem; }
.inset { position: relative; }
/* A pane's own ⋯ stands for its page's. */
/* In the panes view the bar is set in its pane, so a pane or column over that pane covers it too. */
.pane > .selbar { position: absolute; }
.pane .top .more { display: none; }
.pane-btn.more { display: flex; align-items: center; justify-content: center; padding: 0; font-family: var(--sans); font-size: 0.8rem; line-height: 1; letter-spacing: 0.04em; }
.pane-btn.more[aria-expanded="true"] { color: var(--fg); background: var(--sel); }