Skip to content

Studio: use plain arrow icons for up, down, left and right - #10129

Merged
shimmyshimmer merged 1 commit into
mainfrom
studio-plain-arrow-icons
Sep 1, 2026
Merged

shimmyshimmer merged 1 commit into
mainfrom
studio-plain-arrow-icons

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

The single direction arrows came from two places and neither was a plain arrow.

The curved hugeicons chevrons

The hugeicons set draws its chevrons as bezier curves rather than two straight segments meeting at a point, so they bow outward:

ArrowLeft01Icon   M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18
ArrowRight01Icon  M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18

ArrowLeft02Icon and ArrowRight02Icon do the same with a shaft attached. Those six are now the lucide equivalents, which the codebase already used elsewhere for the same job, so this is aligning on the plainer of two conventions already in the tree rather than introducing a third:

ArrowLeft01Icon  -> ChevronLeftIcon
ArrowRight01Icon -> ChevronRightIcon
ArrowUp01Icon    -> ChevronUpIcon
ArrowDown01Icon  -> ChevronDownIcon
ArrowLeft02Icon  -> ArrowLeftIcon
ArrowRight02Icon -> ArrowRightIcon

37 tag sites across 27 files, including one conditional (icon={side === "left" ? ... : ...} in the hub card carousel) which became a ternary over two elements.

The hand rolled caret

ArrowDownStandardIcon was a local svg component with the same path copied into four files:

  • features/chat/mcp-composer-button.tsx
  • features/chat/shared-composer.tsx
  • features/rag/components/knowledge-base-composer-button.tsx
  • components/assistant-ui/thread.tsx

All four are gone in favour of ChevronDownIcon, keeping strokeWidth={1.5} so the caret weight is unchanged.

Not touched

Only single direction arrows changed. Diagonal and bidirectional icons keep their current shape because they are not up, down, left or right: ArrowUpRight01Icon still marks external links, ArrowUpDownIcon still marks sort, and ArrowLeftRightIcon, ArrowExpand01Icon, ArrowReloadHorizontalIcon and ArrowTurnBackwardIcon are left as they are.

HugeiconsIcon and type FC imports that this left unused were dropped.

Testing

  • npm run typecheck clean
  • npm run test: 6275 passing, 0 failing
  • npm run build clean
  • Biome diagnostics identical to baseline across all 32 touched files (751 before, 751 after)
  • No references to the six replaced names or to ArrowDownStandardIcon remain in src
  • The curved path above no longer appears in the built bundle

The directional arrows came from two places and neither was a plain arrow.

The hugeicons set draws its chevrons as bezier curves, so ArrowLeft01Icon is
"M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18" and bows out
rather than meeting at a point. ArrowLeft02Icon and ArrowRight02Icon do the
same with a shaft attached. Those six are now the lucide equivalents, which
the codebase already used elsewhere for the same job:

  ArrowLeft01Icon  -> ChevronLeftIcon
  ArrowRight01Icon -> ChevronRightIcon
  ArrowUp01Icon    -> ChevronUpIcon
  ArrowDown01Icon  -> ChevronDownIcon
  ArrowLeft02Icon  -> ArrowLeftIcon
  ArrowRight02Icon -> ArrowRightIcon

ArrowDownStandardIcon was a hand rolled svg, copied into four files with the
same path in each. It is gone in favour of ChevronDownIcon, keeping
strokeWidth 1.5 so the caret weight does not change.

Diagonal and bidirectional icons are untouched: ArrowUpRight01Icon still marks
external links, ArrowUpDownIcon still marks sort, and ArrowLeftRightIcon,
ArrowExpand01Icon, ArrowReloadHorizontalIcon and ArrowTurnBackwardIcon are all
left as they are. Only the single direction arrows changed.

HugeiconsIcon and type FC imports that this left unused were dropped.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T06:53:44.847174Z aa1b111 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: aa1b111b2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer
shimmyshimmer merged commit 18cbcdb into main Sep 1, 2026
39 of 40 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-plain-arrow-icons branch September 1, 2026 06:54
danielhanchen pushed a commit that referenced this pull request Sep 2, 2026
* studio: find in page on Cmd/Ctrl+F

Adds a find bar to the Studio shell. It floats over the workspace on
screen, tints every match with the active one picked out, counts them,
and walks them with Enter / Shift+Enter or the arrow buttons. Escape
closes it. The chord is a rebindable action, so it shows up in
Settings > Shortcuts like every other one.

The engine only exists while the bar is open, so a Studio nobody is
searching runs one keydown listener and nothing else: no index, no
observer, no ranges.

Highlights are painted through the CSS Custom Highlight API rather than
by wrapping matches in <mark>. Nothing is inserted into the thread, so
nothing reflows, and the text nodes that streaming markdown,
thread-fast-copy and the export path all read back are left alone.

The document is flattened into one string once and searched with
indexOf, so a keystroke never walks the DOM. The flatten is redone only
when the document changes, debounced to 300ms and skipped entirely while
the field is empty.

Correctness details worth calling out:

- completeProgressiveMounts() runs on open, so messages the widen-only
  mount window has not committed yet are still findable.
- Block boundaries get a separator, so a match cannot run from the end
  of one paragraph into the start of the next.
- Off-route workspaces and modal-shadowed content stay out of the count,
  including on a workspace switch, which only flips inert.
- A run whose case fold would change length keeps its case, so offsets
  cannot drift and paint a highlight over the wrong word.

Everything is bounded: 4M characters indexed, 5000 matches counted, 400
ranges painted in a window that travels with the active match.

* studio: lift the find bar off its background a little further

Dark goes #272727 to #2c2c2c. The message cards it floats over are
#212121, and one step was not quite enough to read as a separate
surface while scrolling.

Light keeps the composer's shadow shape but a touch larger and darker,
0 3px 10px -2px at 0.2 rather than 0 2px 8px -2px at 0.16. The composer
sits at the bottom of the page with nothing under it; this bar has a
conversation moving beneath it and needs slightly more to sit on.

The test that pinned the light shadow to the composer's now checks the
relationship instead: same shape, larger blur, higher alpha, and no more
than half again either, so it cannot drift into a different material.
The dark bound moves from --accent to --border, which is the value it
actually has to stay under now that the buttons hover on a plain wash.

* studio: spread the light find bar shadow rather than darken it

Back to the composer's 0.16, wider instead: 0 3px 14px -1px, against the
composer's 0 2px 8px -2px. Same darkness, more of it, which lifts the
bar off a moving conversation without reading heavier than the box it
was copied from.

The test follows: alpha now has to EQUAL the composer's, and blur and
spread both have to grow, so darkening it again fails here.

* studio: soften the light find bar shadow

Alpha 0.16 to 0.13, geometry unchanged. The wider spread is what lifts
the bar off the conversation, so the ink can come down below the
composer's rather than match it.

The test flips with it: alpha now has to be strictly softer than the
composer's, and no less than 0.7 of it, so this cannot fade to nothing
either.

* studio: fixes from review of the find bar

Restore Mod+KeyF in BROWSER_RESERVED_VALUES. I deleted the line while
trimming the comment beside it, and the test that should have caught it
only SKIPPED the deliberate exceptions instead of asserting they are
flagged. It now asserts both directions.

Index:

- Reject subtrees the engine is not painting. Attributes alone missed a
  responsive `hidden lg:flex`, so text nobody can see was counted and
  walked to. checkVisibility, guarded, and opacity left out so a message
  fading in stays findable.
- Fold per code point when the whole-run fold grows. One dotted I made
  every other word in its node case-sensitive.
- Take the prefix of a text node bigger than the ceiling. One Bash log
  arrives as one node, and dropping it whole indexed nothing at all.
- Match a query across collapsed whitespace. A markdown soft wrap is a
  newline inside one text node, so searching the phrase as it renders
  missed. Only queries containing whitespace take the pattern path;
  single words keep indexOf.

Engine and shell:

- Start a fresh query from the scroll container's top, not the window's.
  The thread viewport begins below the navbar, so a match clipped off
  the top of it still had a positive top and sent the reader backwards.
- Refuse to open while any modal backgrounds the scope, using the
  registry's own foreground check rather than the Settings store.
- Fixed rather than absolute, and capped to the viewport. On a route
  whose outer container scrolls, the bar sat at the top of a scope
  taller than the window; on a narrow window it ran off the left edge.

The re-index interval is a throttle, not a debounce. The behaviour is
right, since a debounce leaves the count frozen for as long as a reply
takes to write, so the name and the comment now say what it does.

Measured on a 322K character, 7750 element thread: one flatten is 5ms,
about 1.7% of the interval, with the visibility check in place.

* studio: two more fixes from review of the find bar

Both are against the visibility check and the ceiling I added last round.

Stop asking checkVisibility about content-visibility. A skipped subtree
is not a hidden one: the Hub README sets content-visibility: auto on its
root and every child, and so does a maths-bearing thread, so passing
contentVisibilityAuto dropped everything below the fold from the index.
Nothing would have put it back, since scrolling renders a subtree
without mutating the DOM and the observer never fires. Measured on the
real thing: an element inside a skipped subtree answers false with the
flag on and true with it off.

Text in a skipped subtree has no geometry of its own, so the walk now
aims at the nearest ancestor that is laid out. The subtree keeps its
contain-intrinsic-size box, which is close enough to scroll to, and it
renders on the way, so the highlight lands once it does.

Enforce the ceiling before writing a block separator. A node landing
exactly on the cap let the next separator push length past it, and the
negative room that followed turned slice(0, room) into "all but the last
character" of the following node. Measured overshoot on a 4,000,000 cap:
500,000 characters. Now nothing lands past the cap by any route the walk
can take to it, which is what the second new test asserts.

* studio: three more fixes from review of the find bar

Walk through display: contents wrappers instead of skipping them. An element
with no box is the first thing checkVisibility calls invisible, and the shell
and the training page both wrap their content in one, so the index came back
empty for most of the app.

Re-anchor from the viewport after progressive completion. That growth prepends,
so keeping the ordinal moved the highlight to an older match off screen.

Handle Escape on the bar rather than the field, so it also closes from the walk
and close buttons instead of falling through to the bare-Escape decline.

* studio: six more fixes from review of the find bar

Skip an inline SVG. Only HTML elements report an uppercase tag, so <svg>
answered "svg" and walked past a skip list spelled in HTML casing.

Leave the chord to the browser when the scope is behind a modal. useShortcut
prevents the event before calling the handler, so declining from inside it
killed native find too. New claims option, asked before the event is consumed.

Complete only the progressive mounts this search can read, so opening find on
another route no longer forces a retained conversation to mount every withheld
row.

Hand focus back to where the bar took it from, ignore the Enter that commits an
IME candidate, and keep the chat composer's pill labels out of the index.

* studio: four more fixes from review of the find bar

One rule now decides who keeps their place in the match list: the ordinal
survives a pure append at the tail, which is what a streaming reply produces,
and nothing else. Prepended history, a workspace switch flipping inert and a
breakpoint revealing a column all renumber the list, so they re-anchor to the
reader's viewport. An unchanged document is an append of nothing, which leaves
the settled thread's 400ms mount probe unable to take back an Enter pressed
while it ran.

Invalidate the index on resize as well as on mutations. Crossing a breakpoint
changes what is rendered with nothing in the DOM to observe.

Clear the search when the shell unmounts, so signing out does not hand the next
user the last one's query, open and focused.

* studio: two more fixes from review of the find bar

Leave Escape to the IME while it is composing. The guard was on the Enter path
but not on the bar-level Escape added last round, so dismissing a candidate
closed the bar out from under the word being typed.

Ask for one match past the cap, so a page holding exactly MAX_MATCHES no longer
reads as more than that. findMatches stops at the limit it is given, so the
count alone could not tell the two apart.

* studio: four more fixes from review of the find bar

Take block boundaries from resolved layout, not just the tag name. Tailwind
renders span.block all over the app, and two of those ran together in the index,
so a title above a URL read as one word and matched a phrase on screen nowhere.

Keep whitespace literal where the page keeps it. The flexible run is for prose,
where a soft wrap puts a newline in the node; in a code fence the whitespace on
screen is the whitespace in the node.

Leave a selection alone until there is a match to show. On an engine without the
highlight registry, opening the bar was wiping whatever the reader had selected.

Capture the focus origin once, and never the bar's own field, so StrictMode
replaying the effect in development does not lose it.

* studio: three more fixes from review of the find bar

Keep the contextual fold when a run has to be folded by hand. Greek final sigma
depends on what follows it, so one expanding character in a node was turning
every sigma in it into the wrong letter and text plainly on screen matched
nothing. The whole-run fold is kept everywhere it fits; only the code point that
would have grown is put back as itself.

Reindex when a details element is toggled. That changes the open attribute and
nothing else, while the body inside goes from skipped to searchable.

Keep the hover-only response model badge out of the index. It is transparent and
unclickable until the message is hovered, so a match there was walked to under a
highlight nobody could see.

* studio: four more fixes from review of the find bar

Capture the focus origin against the bar's own element. Guarding on
data-find-skip refused to record the composer, which now carries that attribute
and is where the chord is pressed from most.

Watch the search scope's size, not only the window's. A container query crosses
its breakpoint when the sidebar is pinned or collapsed, with no window resize and
no mutation inside the scope.

Compare the selection before clearing it, so dragging over other text while the
bar is open is not thrown away on close.

Scan rather than match in the observer test: the regex backtracked exponentially
on its own comment lines.

* studio: three more fixes from review of the find bar

Keep the capped match list around the reader. A common letter in a long thread
has far more matches than the cap, and keeping the first 5000 kept only the top
of the document: opening find at the bottom of a chat walked the reader to the
start and hid every occurrence beside them.

Give each text node a share of the index budget. One oversized tool result took
the whole thing and stopped the walk, so the messages on screen were not indexed
at all.

Skip clipped accessibility text. Tailwind's sr-only keeps a real box at full
opacity, so checkVisibility calls it visible and its labels were counted and
walked to under a highlight clipped away with them.

* studio: two more fixes from review of the find bar

Fold the flattened document once rather than a node at a time. The fold of a run
is not the folds of its pieces: a word-final sigma split by inline markup came
out medial while the query came out final, so a word plainly on screen matched
nothing. Scanning every code point in Unicode says dotted I is the only one whose
lowercase changes length, so it is spliced back in as itself and everything else
keeps the contextual fold. Faster than before, and 15x faster on a document
carrying one of them.

Close the seam a clipped node leaves. What the clip dropped is still in the
document, so without a boundary a match across the seam painted over every
discarded character between the two nodes.

* studio: keep the reader on the occurrence, not on the number

Past the cap the kept window recentres as matches are appended, so preserving
the ordinal across a streaming rebuild silently walked the highlight to a
different occurrence. The active match is now followed by where it sits in the
document, and the viewport decides only when that occurrence is gone.

* Fold Turkish dotted I, and search portaled popovers

Two things the bar was getting wrong.

A capital dotted I (U+0130) is the only code point in Unicode whose
toLowerCase is longer than itself, and the fold kept it as itself to
hold the one-character-per-character rule the offsets depend on. That
made it case-sensitive on its own: of "istanbul", "Istanbul", "ISTANBUL"
and the exact spelling, only the exact one matched text the platform's
own find matched for all four. It now maps to a bare i, which is the
Turkic case fold and is length-preserving, so the splice the old fold
needed is gone with it.

A popover portals its content to the body, outside the scope, so the
model picker's list was on screen and unsearchable while the page behind
it was searched instead. The flatten takes extra roots, the engine
resolves the foreground surfaces on each rebuild, and the observer
watches the document since a portal is a sibling of the shell rather
than a mutation of it. A dismissed surface keeps its box until its
close animation finishes, so data-state is both watched and checked.

* Four fixes the find bar needed on engines other than Chromium

Found by driving smoke-find-in-page.html on chromium, firefox and webkit,
with the two capabilities the bar branches on degraded deliberately.

Keep the find field typable when there is no highlight registry. Moving the
document selection out from under a focused field takes the caret with it on
WebKit and Blink: activeElement still reports the field, but every keystroke
after that is swallowed. Measured with the registry removed, the input held
"u" and never grew, so the query froze at one character and the bar could not
be typed into at all. That is the fallback path, which is Firefox below 140 or
whatever WebKitGTK the desktop build was handed, and the desktop build is the
one platform with no native find to fall back on. The caret is now taken before
the selection moves and handed back after. Gecko keeps both; WebKit and Blink
drop the selection to give the caret back, which is the better half to lose.

Ask checkVisibility for both spellings of every option. visibilityProperty and
opacityProperty are renames of checkVisibilityCSS and checkOpacity, and Web IDL
drops a dictionary member it does not recognise without complaining, so sending
only the modern name is not a fallback, it is a no-op on Chrome 105 to 120 and
Firefox 106 to 121. Those builds have the method but not the rename, and would
index, count and highlight visibility: hidden text.

Keep a display: contents wrapper's own text out when the wrapper is hidden.
skipsSubtree lets a boxless wrapper through on purpose, and re-checks its
element children on the way down, but a direct text child is never asked. So
text under a contents wrapper that is also visibility: hidden was searchable.
Scoped to the element's own text, so a descendant restoring visibility: visible
is still found.

Reindex when data-find-skip is added, not only when it is removed. closest
matches the element it starts at, so the record announcing that a region became
skippable answered "inside skipped content" and was filtered out, leaving that
region in the index until some unrelated mutation happened by. The attribute is
in the observer's attributeFilter precisely so both directions land.

Resolve the match window anchor lazily. viewportOffset walks the document
reading rects, and an argument is evaluated whether or not the callee wants it,
so spelling it inline ran a binary search over layout on every keystroke of
every query however few matches it had, which is the opposite of what its own
comment promises. Measured over a seven character burst on an 88 message
thread: 110 forced Range rect reads before, 54 after. A numeric anchor still
means what it did.

mutatesSearchableText moves to find-dom.ts so a test can hand it a record; the
hook imports React and cannot be loaded under node --test.

* Run the find bar in a browser in CI, on three engines locally

smoke-find-in-page.html shipped without a driver, so nothing ran it. Every
other smoke page in this tree has a tests/studio/playwright_*.py beside it that
CI invokes, and test_playwright_suites_run_in_ci.py enforces that for any file
matching that glob, which is why the driver and its workflow step land here
together.

What it covers is the half the node suite cannot reach. The flatten, the offset
map and the search are pure and already well tested; a Range has no geometry
off a document, CSS.highlights paints nothing, and a chord the browser owns
cannot be taken from it in a unit test. So this checks the chord, the count
against an inert workspace, the walk and its scrolling, a streamed reply
raising the count without moving the reader, the modal gate, and that both
highlight registries are torn down on Escape.

It also degrades the engine twice, which is how the interesting cases are
reached on a modern binary. Removing the highlight registry gives the fallback
path, which is Firefox below 140 and older WebKitGTK. Shimming checkVisibility
to honour only the historic option names gives Chrome 105 to 120 and Firefox
106 to 121. Both of those found real bugs, fixed in the previous commit.

Chromium in CI because that is what the Frontend CI job installs, matching the
keyboard shortcut smoke beside it. SMOKE_ENGINES=chromium,firefox,webkit runs
the same checks against all three, which is 273 checks and how this was
developed.

* Fix visibility off the checkVisibility path, and match either spelling

Three things, one declined.

checkVisibility landed in Safari 17.4, and WebKitGTK is already a
supported engine here: it is the one selectRangeFallback exists for.
The optional call answers undefined there, and reading that as "not
false" put every display: none subtree back in the index. Measured with
the API deleted: a responsive panel hidden at the current breakpoint
counted 1/1 and was walked to under a highlight nobody can see. It now
falls back to computed display and visibility, which is what the call
above it asks for. display: contents is left out of the fallback, so
hidesOwnText keeps covering the text it holds directly and a child that
turns visibility back on is still reached.

The same word can be composed or decomposed and look identical: café is
four code points or five. macOS hands back decomposed filenames while a
model writes composed prose, so both turn up in one thread, and the
platform's own find matches either from either. Normalizing the index
would change its length and misplace every offset in it, so the
spellings go in the pattern instead and the document is left alone.

The action bar over a generated image is transparent until the card is
hovered from sm up, so its "Edit" was counted and walked to invisibly.
Marked like the response model badge. Opacity stays off in general:
every user message fades in, and reading it would drop one mid-fade
with no mutation to put it back.

The browser harness grows a third degraded engine, one with no
checkVisibility at all, and a display: none probe for it to catch. It
also plants a decomposed word, and checks that the painted range covers
what the document wrote rather than a normalized copy of it.

Not done: the anchored count no longer walks the whole document past
the point where it can still move the window, which halves it at a
mid-document anchor. Bounding it outright would need an index, and the
worst case measured is 9.5ms.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fold both sigmas, look again after a skipped block renders

Three fixes, one declined.

Greek. toLowerCase picks between the two lowercase sigmas by position,
so ΟΣ folded to a final sigma while the same word typed with a medial
one did not, and half the spellings a reader can produce found nothing
that was plainly on screen. Measured: chromium, firefox and webkit all
match ΟΣ from either. Both now fold to the medial form, which is what
CaseFolding.txt maps the final one to, and both are one code point so
nothing moves.

Scrolling to a match under content-visibility: auto. A scroll reaches
only as far as the scrollHeight the engine knows about, and a skipped
subtree contributes its contain-intrinsic-size placeholder until it
renders; reaching toward it is itself what makes it render. Measured on
a 2904px block behind a 140px placeholder: the reader was left 3415px
below an 800px viewport on all three engines, with the match counted
and highlighted somewhere off screen. The reveal now looks again while
the scroll is still moving, which ends after 2 frames on webkit and 3
on chromium and firefox.

Typing hid this, which is why it lasted: every keystroke reveals again
and those repeats do by accident what the fix does on purpose. A pasted
query, an Enter, or a click on a walk button is one reveal. The probe
pastes for that reason.

The observer filter. The shell keeps Chat, Images, Video and Audio
mounted under hidden and inert so a long generation is not cancelled by
navigating away (__root.tsx), and they sit inside the scope, so every
character such a reply streamed bought a full flatten that then
correctly threw that text away. The filter now turns back at the same
attributes the index does, and asks from the parent whichever attribute
changed, so a workspace being parked is still the news that it left.

Not done: text past a line-clamp is indexed though only its prefix is
painted. Real, but every engine's own find does the same, and telling
which characters are past the clamp needs per-character geometry.

The browser harness grows a probe for the reveal, planted as a block
far taller than the placeholder standing in for it.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Say three degraded engines in the CI note, since there are now three

* Keep a portaled surface searchable over a document at the ceiling

The workspace is walked first, because that is where it sits in the
document, and filling the budget sets `full`, which the loop over the
portal roots then breaks on. So a conversation long enough to reach
MAX_INDEX_CHARS left the model picker's list out of the index entirely,
which is the one surface portal support was added for and the one the
reader is looking at.

The workspace now gives up 100,000 characters of its share, 2.5% of the
ceiling, and the portal roots are walked against the full budget after
it. Held back only while there is a portaled surface open to hold it
for: with none, the workspace still gets the lot and the ceiling means
what it always did, which an existing test pins.

Order is unchanged. Walking the portals first would fix this too, but a
body-portaled element comes after the shell in document order, and the
walk follows the document.

* Tighten the find-in-page comments

The reasoning in this feature is worth keeping, but a lot of it was running two
or three paragraphs where two lines carry the same point. This is that pass:
same facts, same measurements, same warnings, fewer lines to get to them.

360 lines of comment out, 229 back, and no executable change anywhere. Verified
by transpiling every touched TypeScript file with removeComments before and
after and diffing the emit, which is byte identical in all five, and by
comparing the Python AST with docstrings normalised for the driver.

Two things fixed while in there. `eachMatch` carried two stacked doc comments,
the first of them describing `findMatches` rather than the function it sat on.
And the driver's module docstring still said two degraded engine modes after a
third was added.

npm test 6169 passing, typecheck, i18n parity and build clean, bundle within
budget, eslint clean, biome unchanged at the two pre-existing errors in
find-in-page.tsx. The browser driver is 144 of 144 on chromium.

* Fix canonical-equivalence matching and oversized-query crash for PR #10061

* Cancel queued reveal passes when the search is dismissed for PR #10061

* Reach the last match, read style once, and follow the app's arrows

Four things found going over this against its merge base. The reveal-chain one
you already fixed in 4ef77f6 while I was writing it, so this is the rest.

**The final match in the document was unreachable from the bottom of it.**
`search` asks `findMatches` for `MAX_MATCHES + 1` so a page holding exactly the
cap does not have to read as a floor, then throws the extra one away. Taking it
off the tail is right only while the window starts at the top. Once the reader
is far enough down the anchored window IS the tail, so the discarded entry was
the document's last occurrence, which is also the one nearest them. Reproduced
on 6000 matches with the reader at the bottom: the window covered the final
occurrence at offset 11998 and the walk ended at 11996. The trim now takes
whichever end the reader is further from, judged by the anchor `findMatches`
had already resolved, so it costs no second layout read and still costs nothing
under the cap, where the thunk is never called.

**`getComputedStyle` ran twice per element.** `skipsSubtree` resolved a style
and so did `visit`, while the comment on `computedStyle` says "One read per
element" and quotes the 8000-element measurement on that basis. The tag and
attribute half of the rule is now asked first and on its own, so a subtree
turned down on markup costs no layout read at all and everything else costs
one, which is what the comment already claimed.

**`text-[15px]` on the query field.** A raw pixel size ignores the UI font size
preference, which `tests/studio/test_ui_font_scale_contract.py` exists to catch,
and it was failing on it. Now `text-ui-15`, the token for that size.

**The walk arrows were the hugeicons 02 pair.** #10129 moved every directional
arrow in the app to lucide because that shaft is a bezier that bows out rather
than meeting at a point, and after it there is no other use of the pair left in
the tree to match.

Verification: 115 in the find suite, 6178 in the frontend suite, typecheck and
locale parity clean, build within the bundle budget. The font-scale contract is
back to 12 passing. Separately, on the pre-rebase tree: 432/432 in the browser
harness across chromium, firefox and webkit, and 339/339 in the
keyboard-shortcuts harness across the same three on macOS, Windows and Linux,
which is what says `claims` left the other 51 shortcuts alone.

Five regression tests, each A/B'd against a revert of the code it covers.

* Catch lazily-compiled regex failures and skip the compare composer for PR #10061

* Match a word that mixes the two canonical spellings

Alternating whole spellings of the query only reaches text that is all-composed
or all-decomposed. One occurrence can be neither: joining two text nodes joins
two sources, so a composed accent in one and a decomposed one in the next make
a single visible word with a spelling the query cannot be written in.

Measured against the platform, which is the baseline the rest of this file is
held to. Native find matches a mixed occurrence from an all-composed query on
chromium, firefox and webkit; this returned nothing, including for the
two-inline-nodes shape the flatten itself creates.

The pattern is now built per cluster rather than per query, which is also
smaller than what it replaces: the old form wrote the whole query once per
spelling, this writes it once and pays about eight characters for each cluster
that actually has two spellings. That matters here because an oversized pattern
is refused by the engine, which is why matchPattern catches a compile failure at
all.

The preserved-whitespace guard widened with it. "Spelt the way it was typed" can
no longer be a lookup in a list of whole spellings, since a mixed hit is in no
such list; it is now equality after composing, which whitespace flexing does not
survive, so a hit that only flexed a space is still told apart from one that
merely spells a letter differently.

One regression test, A/B'd against a revert of the code it covers: 117 in the
find suite, 6180 in the frontend suite, typecheck and locale parity clean, build
within the bundle budget.

* Drop the dead single-element alternation in matchPattern for PR #10061

* Close the find bar on Escape wherever focus is

The handler sat on the bar, so it only ever saw presses that started inside it.
Clicking a message to read it is the ordinary thing to do with a find bar open,
and from there Escape did not close it.

The second half is what makes this more than an annoyance. `declineToolRequest`
is bare Escape with `skipInTextFields`, and `isTextEntryFocused` only recognises
INPUT, TEXTAREA and contenteditable, so a message body does not shield it. With
a tool confirmation waiting, the unprevented Escape carried on to the registry
and denied the call. Closing a find bar must not be able to answer a tool
request.

Now a window listener for the lifetime of the open bar, in the capture phase so
it runs ahead of the registry's own keydown rather than racing it. Two presses
it deliberately does not take: a modal above the bar backgrounds the scope and
owns Escape, and an open popover, menu or listbox is dismissed by its own
Escape first. Composition is still left to the IME.

The handler on the landmark is gone rather than kept alongside, so there is one
path in and the inside presses cannot be taken twice.

117 in the find suite, 6180 in the frontend suite, typecheck and locale parity
clean, build within budget, and 432/432 in the browser harness across chromium,
firefox and webkit, which is where an event-phase change is actually decided.
The capture assertion was A/B'd: switching the listener to the bubble phase
fails it.

* Keep the find constants out of the startup bundle for PR #10061

---------

Co-authored-by: danielhanchen <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

1 participant