Repository navigation
studio: find in page on Cmd/Ctrl+F - #10061
Conversation
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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
|
@codex review |
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.
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.
|
@codex review |
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.
|
Went through all eleven. Nine were right and are fixed in 1fd766d, one I could not reproduce as described, and one I am leaving as designed. Details below, with what I actually checked in each case. FixedAdd Mod+KeyF to the reserved-binding set. Correct, and my fault: I deleted the line while trimming the comment next to it. Exclude CSS-hidden content from the index. Correct. The predicate only read attributes, and a responsive Preserve case-insensitive matching around expanding folds. Correct. Index the prefix of an oversized text node. Correct. A single node past the ceiling indexed nothing at all, which is exactly the content the ceiling exists for. Confirmed: a 4M+ character node produced an empty index and zero matches for a word in its first eight characters. Now takes the prefix that fits. Match whitespace as it is rendered. Correct, and the case that matters most is not multiple spaces but a markdown soft wrap, which is a newline inside one text node rendered as one line. Searching the phrase a reader can see missed it. A query containing whitespace now matches runs of whitespace in the document; single-word queries, which are most of them, keep the Compare matches against the scroll viewport top. Correct. Measured the thread scroller's top at 122px in the harness, scrolled until one match sat between the window top and the scroller top, and confirmed the old rule picked that clipped occurrence while the new one picks the first match actually on screen. Disable find while any modal backgrounds the scope. Correct that the gate only tracked Settings. One correction to the reasoning: the scope would not have been zero-result, since Keep the bar visible in non-chat scroll containers. Correct. Reproduced by adding an outer-scroller mode to the harness. Now fixed rather than absolute, with a top offset derived from Fit the find bar within narrow viewports. Correct, it measured 452px with no cap. The input is now narrow by default and wide from Corrected rather than changedDebounce reindexing from the final streaming mutation. The description of the code is right, it is a throttle. The behaviour is the one I want, though: a true debounce leaves the count frozen and newly arrived text unfindable for as long as a reply takes to write, which can be minutes. So I fixed the name and the comment instead of the code, since the documentation was what was wrong. On the cost concern, measured on a 322K character, 7750 element thread, which is the worst rung #9016 benchmarks: one flatten is about 5ms, roughly 1.7% of the 300ms interval, with the new visibility check included. Same figure whether style is clean or was just dirtied by an insertion. Not changingPreserve existing user ownership of Mod+KeyF. The mechanism is real, |
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.
|
Both of these are right, and both are against code I added in the last round. Fixed in e76db4c. Keep content-visibility subtrees searchable. Correct, and it is worse than a Hub README: The distinction that makes it real is that
So the walk was rejecting exactly the descendants it needed. The flag is now off, which leaves genuinely hidden elements rejected as before. And you are right that nothing would have recovered it: scrolling renders a subtree without mutating the DOM, so the observer never fires. There is a second half the finding does not mention. Text in a skipped subtree has no geometry of its own, so a range inside it comes back collapsed and the walk could not scroll to it even once indexed. The reveal now falls back to the nearest ancestor that is laid out, which for a skipped subtree is its Enforce the cap before adding a block separator. Correct, and the overshoot is as large as you describe. Reproduced with a node landing exactly on
|
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
|
All three are right. Fixed in fabb09a. Descend through display-contents wrappers. Correct, and the blast radius is bigger than the training page. Measured in a browser on a wrapper with one visible child:
So the walk was rejecting a subtree on the strength of the one element in it that has no box. Four places use the class:
if (checkVisibility(...) !== false) return false;
return computedDisplay(element) !== "contents";
Re-anchor after progressive rows are prepended. Correct. Reproduced with a thread opened at a retained query, scrolled to message 21, with six older messages arriving inside the progressive window. Same run, the only difference being what the completion rebuild passes:
1742px above the top of the viewport, and the next step from there walks further back into the history the reader never asked for. Re-anchored, the active match is exactly the first one at or after the viewport top. The observer's throttled rebuild still keeps the ordinal, which is the append-only case it was written for; a test now pins that there is exactly one caller left doing so. Handle Escape beyond the query input. Correct. The handler moved from the field to the landmark, so it catches the bubble from all four controls. Measured with a counter on the window listener, counting only presses that arrive not already defaultPrevented:
The last row is the control: it is the path Escape took from the walk buttons before. Three regression tests, and the harness grew a |
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.
|
All six are right. Fixed in cf3f668. Normalize SVG tag names before applying the skip list. Correct. Measured on an inline
So the one entry in the list that can appear in a foreign namespace was the one entry that never matched. With the harness carrying a diagram, a search for its label came back Let native find handle backgrounded modal content. Correct, and it is a regression this PR introduced: before it, Cmd/Ctrl+F behind a modal opened the browser's own find. Measured on the same chord:
The middle row is the dead chord. Complete only progressive mounts in the active scope. Correct.
One trap worth naming: the loop's exit condition read Restore focus after closing the find bar. Correct.
The second row is the guard: it only restores when closing dropped focus on the floor, so it never takes focus back from somewhere the reader put it. Ignore navigation keys while the IME is composing. Correct. An Enter carrying the composition flag was prevented and walked the match list:
Exclude the chat composer from the search scope. Correct. The draft itself lives in a textarea the index cannot read, so what the composer actually contributed was its chrome: Six regression tests, and the harness grew an inline SVG. Full pass green: typecheck, locale parity, 6112 tests, build within budget, and lint back at its baseline count on every file touched. |
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.
|
All four are right. Fixed in fa9ef22. Three of them are the same question asked in three places: when a rebuild finds a different document, does the reader's ordinal still mean anything? Rather than answer it per call site, there is now one test. The ordinal survives a pure append at the tail, and nothing else: return !indexRef.current.text.startsWith(before);A streaming reply only ever adds to the end, so match 20 is still match 20. Everything else renumbers, and re-anchors to the viewport instead. An unchanged document is an append of nothing, which is what makes the third finding fall out for free. Re-anchor matches after non-append mutations. Correct. Modelled the shell's two parked workspaces in the harness, since
711px above the top of the viewport, in a workspace the reader had not looked at yet. Rebuild the index when responsive visibility changes. Correct, and nothing recovered it.
The third row is the part worth naming: nothing marked the index stale, so even editing the query kept searching the layout that had gone. A Preserve navigation made during the progressive-mount probe. Correct, and it is a consequence of the previous round's fix. The probe waits out its 400ms search interval on a settled thread even though it mounted nothing, and the re-anchor was unconditional. With three Enters pressed inside that window:
7 is what the viewport anchor computes there, measured directly: the active match is 9th in document order while the first match at or below the viewport top is 7th. That gap is the jump back. It only appears when the walk did not have to scroll, which is the common case in a window tall enough to show several matches at once. Clear find state when crossing the authentication boundary. Correct.
Reset on unmount rather than on Checked the append case did not regress along the way. A reply landing at the tail: 6/27 to 6/28, ordinal held. A removal: re-anchored, as the rule now says it should. Four regression tests, and the harness grew a second parked workspace and a shell that can unmount. Full pass green: typecheck, locale parity, 6116 tests, build within budget, lint errors at their baseline count on every file touched. |
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.
|
Both are right. Fixed in 30bf0b0. Preserve Escape during IME composition. Correct, and it is a gap I opened last round: moving the handler from the field to the landmark carried the Enter path's composition guard nowhere. The file that defines
Letting it through is safe rather than merely quieter: Show '+' only when matches exceed the cap. Correct. Driven through the real bar with a block of that exact size:
Three regression tests. Full pass green: typecheck, locale parity, 6119 tests, build within budget, lint errors at their baseline count on every file touched. |
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.
|
Round 20: both items were correct, and one of them is a gap in my own previous fix. Both fixed in 7befd69. Lazily-compiled regex still threw at scan time. V8 compiles a regex on first use, not in the constructor, so the oversized-pattern guard I added last round caught nothing: the constructor accepted a 199,997 character source and the Worth recording that my first attempt at the regression test passed with and without the fix, because the query was longer than the haystack and the length guard returned before a pattern was ever built. The test now uses a query shorter than the index and I confirmed it fails without the fix and passes with it. Compare composer was not skipped. Verification: 6179/6179 tests, typecheck, i18n:check:strict, build and bundle:check clean. Biome is unchanged from the head I started on, 2 pre-existing errors in Earlier this round: 432/432 browser checks across chromium, firefox and webkit, and staging CI on danielhanchen#1277. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
|
Status check on the current head, plus one small cleanup in ce5d6b7. The 38 red checks on this PR are cancelled, not failed. Every run for ba14739 was created at 11:27:30 and stopped at roughly 2m40s, with conclusion The staging failures were a stale snapshot, not a live defect. Staging had been replicated at 4ef77f6, two commits back, and reported Cleanup. The per-cluster canonical source reads correctly to me and composes properly with what was already there: the length guard and the Verification on the current head: 6180/6180 frontend tests, typecheck clean, biome at the 2 pre-existing errors in this feature, pre-push gate PASS. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f8a50a75b
ℹ️ 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".
| */ | ||
| function canonicalSource(needle: string, dotted: boolean): string { | ||
| let out = ""; | ||
| for (const [cluster] of needle.normalize("NFD").matchAll(CLUSTER_PATTERN)) { |
There was a problem hiding this comment.
Preserve composed Hangul in canonical patterns
For any Hangul query, NFD decomposes a syllable such as 가 into separate Jamo, but CLUSTER_PATTERN does not group those Jamo as one cluster. Normalizing each Jamo back to NFC therefore leaves the regex containing only the decomposed spelling, while the normally composed text in the index no longer matches—even an exact query like findMatches(...text: "가", "가") returns no results. Group Hangul composition sequences or retain the whole composed alternative when constructing this pattern.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and severe: every Hangul query returned nothing, an exact one-syllable query included. Reproduced against an index whose text is literally 가나다 hello, where 가, 가나다 and 나다 each gave zero matches.
This PR was merged before I could land the fix, so it is in #10200 along with a bundle-budget fix. Hangul now gets its own branch in CLUSTER_PATTERN, ahead of the general one and covering Jamo Extended-A and Extended-B, so a syllable's leading, vowel and trailing Jamo stay one cluster and compose back. Both spellings reach the other, and accented Latin is unchanged.
|
Two CI findings from the staging run, one real and one not ours. The startup bundle budget was genuinely broken by this PR, and is now fixed in afee89e. Staging failed
So main had already eaten almost all the headroom, but the PR is what crossed the line. The cause was the barrel: Result: 1553.0 KB, within budget with 9.5 KB to spare, which is more headroom than main has on its own. That is a better fix than raising BUDGET, which the check offers as the alternative. The Also worth recording: the red checks on the PR itself were cancelled, not failed. Every run for the previous head started at 11:27:30 and stopped at about 2m40s with conclusion Verification on the current head: 6180/6180 frontend tests, typecheck, i18n:check:strict, build and bundle:check all clean, biome at the 2 pre-existing errors in this feature, 432/432 browser checks across chromium, firefox and webkit, pre-push gate PASS. On the Escape fix: we reached the same conclusion at the same time and my version conflicted with 9f8a50a. Theirs is the better of the two, since it also stands aside for a backgrounded modal and for an open popover, so I dropped mine and kept only the bundle change. |
|
@codex review |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afee89e172
ℹ️ 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".
| const spaced = raw | ||
| .replace(HARD_SPACE_PATTERN, " ") | ||
| .replace(DOTTED_I_PATTERN, "i"); | ||
| const folded = spaced.toLowerCase(); |
There was a problem hiding this comment.
Handle multi-character Unicode case folds
When visible text contains a German sharp s, such as Straße, and the user searches using the conventional uppercase spelling STRASSE, this lowercases the strings to straße and strasse, respectively, so the finder returns no match. Unicode case folding also expands characters such as ß and ligatures, meaning toLowerCase() does not fulfill the function's case-folding contract; add length-changing alternatives during matching while preserving the original DOM offsets.
Useful? React with 👍 / 👎.
| const PORTAL_SURFACE_SELECTOR = | ||
| '[data-slot="popover-content"], [role="menu"], [role="listbox"]'; |
There was a problem hiding this comment.
Include the floating monitor panels in portal search
When the floating API monitor or resource monitor is open, all of its visible text remains outside the marked scope: __root.tsx mounts ApiMonitorOverlay before the scope, settings-dialog.tsx does the same indirectly for FloatingMonitor, and neither panel emits any selector listed here. Because Cmd/Ctrl+F is nevertheless consumed by the custom finder, users cannot search the visible request log or resource readout; mark these interactive panels as searchable portal surfaces or mount them inside the scope.
Useful? React with 👍 / 👎.
| function clippedAway(style: ResolvedStyle | null): boolean { | ||
| return ( | ||
| style?.clipPath === "inset(50%)" || | ||
| style?.clip === "rect(0px, 0px, 0px, 0px)" |
There was a problem hiding this comment.
Map KaTeX matches to the painted equation
When a Markdown response contains KaTeX, .katex-mathml is clipped with clip: rect(1px, 1px, 1px, 1px), which this exact check does not exclude, while the actually painted .katex-html sibling is discarded because KaTeX marks it aria-hidden="true". The finder therefore indexes the clipped MathML tree and its annotation—often producing duplicate counts—but every resulting highlight is invisible. Fresh evidence beyond the earlier decorative-separator case is KaTeX's concrete split between a clipped searchable mirror and an ARIA-hidden painted tree; special-case that pair so ranges map to the painted equation.
Useful? React with 👍 / 👎.
|
This merged while I was mid-review, so recording the two findings that landed with it and where they are fixed: #10200. Hangul search returns nothing at all. NFD takes a syllable apart into leading, vowel and trailing Jamo, none of which are combining marks, so The startup bundle is over budget on main, at 1566.2 KB against 1562.5 KB, which makes that job red for every PR opened against One correction to my earlier comment here: I said moving the attribute constants into their own module fixed the budget, with a "9.5 KB to spare" number. That measurement was taken on this branch alone rather than on the merge with Also for the record, the red checks on this PR at merge time were cancelled rather than failed: every run for the head started at 12:11 and stopped at around 2m40s, including Rust and Tauri jobs a frontend change cannot reach. |
Adds a find bar to the Studio shell, on
Cmd+F/Ctrl+F.It floats over the workspace on screen, tints every match with the active one picked out, counts them, and walks them with
Enter/Shift+Enteror the arrow buttons.Escapecloses it, and pressing the chord again re-selects the field so the next keystroke starts a new search. It is a rebindable action, so it appears in Settings > Shortcuts alongside the rest.Why not just leave it to the browser
The browser's own find cannot reach a message the widen-only mount window has not committed yet, counts the sidebar and the composer as part of the page, and does not exist at all on the desktop build. This is the one default that deliberately takes a chord the browser owns. The chord is cancellable in every engine we ship on, so the handler wins it, and Settings still flags it as browser-reserved.
Keeping it off the hot path
The thing that matters here is that a Studio nobody is searching pays nothing, and that a Studio somebody is searching does not stutter.
FindInPagerendersnullunless open. The index, the mutation observer and the highlights all live inside the bar, so a closed bar is one boolean in a store and one keydown listener.Highlightis a set ofRanges drawn over text that is already laid out. Nothing is inserted, nothing reflows, and the text nodes that streaming markdown,thread-fast-copyand the export path all read back are left alone. Wrapping matches in<mark>would mutate the thread on every keystroke and would also retrigger our own observer.indexOfover a string. One flatten of a 40-message conversation measured 0.1 to 1.0 ms, and typing a 14-character query produced zero long tasks.Correctness details worth calling out
completeProgressiveMounts()runs on open, so messages the mount window has not committed yet are still findable.inert) and modal-shadowed content (aria-hidden) stay out of the count. Switching between two kept-alive workspaces only flipsinertand adds nothing, so the observer watches that attribute too, otherwise the bar would keep reporting matches from the workspace you just left.Look
No border in either mode. Light is the chatbox's own background and shadow, pinned to
.unsloth-composer-surfaceby a test so a composer restyle fails here rather than drifting a shade off. Dark sits one step above--card, because the bar floats over cards that are themselves--cardand would otherwise dissolve into whatever scrolls under it. That step is also what gives the buttons inside a hover that shows: the ghost variant's own--muted/50lands within a shade of the surface.Verification
smoke-find-in-page.html, a new harness in the existingsmoke-*style, driven in a real browser: chord opens and the browser's own find bar stays suppressed, 24 matches counted with aninertpanel's 3 correctly excluded, Enter and Shift+Enter walk and scroll while leaving an already-visible match alone, a streamed reply took the count 24 to 25 without yanking the reader, Escape tears down both highlight registries, light and dark both legible.typecheckclean,i18n:check:strictclean, 6090 of 6090 tests pass,buildsucceeds within the bundle budget, eslint clean on the new code.