@@ -444,10 +444,12 @@ createShadowStage(watchDisclosures);
444444const {
445445 byCommand,
446446 claimsEsc,
447+ documentFocused,
447448 elementScopes,
448449 focused,
449450 merge,
450451 pruneScopedElements,
452+ recoveredLabelFocus,
451453 scopeRefs,
452454 scopesFor,
453455} = createScopes ( {
@@ -456,17 +458,18 @@ const {
456458} ) ;
457459
458460// Where the reader is standing, painted: the ring on the ask they are in, the mark on the
459- // passage of the comment they are in, and the line saying what the next press does from
460- // there. One repaint, because it is one question — every reading is of the focus and the
461- // open-ask list, and every signal that moves either (a focus move, an answer taken, a
462- // poll, a widget's own state) moves them all.
461+ // passage of the comment they are in, the focused box's hint, and the line saying what the
462+ // next press does from there. One repaint, because it is one question — every reading is of
463+ // the focus and the open-ask list, and every signal that moves either (a focus move, an
464+ // answer taken, a poll, a widget's own state) moves them all.
463465//
464466// Coalesced to a frame: a focus move is a focusout then a focusin, and painting between
465467// them would flash the scope of nowhere and drop the ring for a frame. Here rather than
466468// beside the renders it schedules, because the scopes core declares call it as the module
467469// evaluates, which is before the line has an element to draw into — the frame is what puts
468470// the first paint after both.
469471let herePending = false ;
472+ let paintInputHints = ( ) => { } ;
470473function paintHere ( ) {
471474 if ( herePending ) return ;
472475 herePending = true ;
@@ -481,6 +484,7 @@ function paintHere() {
481484 // panel's own render was calling the chip pass.
482485 paintAddresses ( ) ;
483486 paintCoreControls ( ) ;
487+ paintInputHints ( ) ;
484488 renderLine ( ) ;
485489 } ) ;
486490}
@@ -1376,7 +1380,13 @@ layoutSizes.observe(composer);
13761380const { showToast } = createNotifications ( { liveEl, syncLayout, toastEl } ) ;
13771381
13781382// ---------- text inputs ----------
1379- const wireInput = createInput ( { keys, showToast, spell } ) ;
1383+ const { paint : paintInputs , wire : wireInput } = createInput ( {
1384+ focused,
1385+ keys,
1386+ showToast,
1387+ spell,
1388+ } ) ;
1389+ paintInputHints = paintInputs ;
13801390
13811391const { landTyping, pageSelection, selectionAnchor, snapSelection } =
13821392 createSelectionCapture ( {
@@ -1686,7 +1696,7 @@ const hasThreads = () => openThreads().length > 0;
16861696// control inside it, whose own press is its own. Open and resolved threads both qualify:
16871697// each has a primary Enter action and x changes the same resolution state in either direction.
16881698const focusedThread = ( ) => {
1689- const active = document . activeElement ;
1699+ const active = documentFocused ( ) ;
16901700 return active ?. classList ?. contains ( "lf-thread" ) ? active : null ;
16911701} ;
16921702// The item the reader is standing in, which is what a press means when they have pointed
@@ -1717,12 +1727,12 @@ const focusedThread = () => {
17171727// from one means the page whole. A box that takes letters never arrives here at all: the
17181728// typing scope claims the letter before the page is asked.
17191729//
1720- // `document.activeElement ` rather than `focused()`, for the reason askPosition gives: a
1721- // control staged in a shadow tree retargets to its host, and the host is the place in the
1722- // document both the chrome guard and the item walk want. standingConversation below wants
1723- // the other reading, and says so.
1730+ // `documentFocused() ` rather than `focused()`, for the reason askPosition gives: a control
1731+ // staged in a shadow tree retargets to its host, and the host is the place in the document
1732+ // both the chrome guard and the item walk want. standingConversation below wants the inner
1733+ // reading, and says so.
17241734const standingItem = ( ) => {
1725- const held = document . activeElement ;
1735+ const held = documentFocused ( ) ;
17261736 if ( ! held || held === document . body || inChrome ( held ) ) return null ;
17271737 const working = held . matches ?. ( ASK_CONTROL ) ? standingIn ( ) : null ;
17281738 return working ?? itemAt ( askPlace ( held ) ) ;
@@ -1896,7 +1906,7 @@ const letGo = () => document.body.focus({ preventScroll: true });
18961906// Their next Space is then that button rather than the page's scroll. CLAUDE.md's "The
18971907// reader has to be standing somewhere" holds the rest.
18981908function rung ( ) {
1899- const active = document . activeElement ;
1909+ const active = documentFocused ( ) ;
19001910 const holding = Boolean ( active ) && active !== document . body ;
19011911 if ( fabAnchorAt ( ) )
19021912 return {
@@ -2048,6 +2058,7 @@ const {
20482058} = createAskView ( {
20492059 PAGE_PAINT_ATTRIBUTE ,
20502060 SCROLL ,
2061+ documentFocused,
20512062 announce,
20522063 askEntry,
20532064 askSource,
@@ -2267,12 +2278,12 @@ const COMPOSER = {
22672278// the scope rather than below it, because a row naming a predicate directly reads the
22682279// binding as the table is built — the deferring wrapper the branch here used to need was
22692280// the only thing hiding that.
2270- const inTheBox = ( ) => panel . contains ( document . activeElement ) ;
2281+ const inTheBox = ( ) => panel . contains ( documentFocused ( ) ) ;
22712282// The panel thread the reader is in, asked by class because that is the anchors module's
22722283// question: which logged thread's passage to paint. It is not the box's way out, which
22732284// climbs further and answers for a seat on the page too — the two readings stayed apart
22742285// rather than one standing in for the other.
2275- const focusedThreadOf = ( ) => document . activeElement ?. closest ?. ( ".lf-thread" ) ;
2286+ const focusedThreadOf = ( ) => documentFocused ( ) ?. closest ?. ( ".lf-thread" ) ;
22762287// Where a box hands the reader back to, which is the rung `c` came down. It asked
22772288// `.lf-thread` and the panel alone, so the two boxes outside the chrome — a conversation
22782289// seated on the page, and each thread on that seat — had no way out but the page's own
@@ -3018,6 +3029,7 @@ const { availableCommands, executeCommand, readerIn, shadow, stack } = createDis
30183029 keepShown,
30193030 paintHere,
30203031 panel,
3032+ recoveredLabelFocus,
30213033 SCOPES ,
30223034 scopesFor,
30233035 setChord,
@@ -3180,13 +3192,16 @@ const unaccountedGesture = () =>
31803192// have typed — a composition surface is a focused textarea, any holding words, or a
31813193// widget-built one (data-lf-offer) even empty, because deleting everything is still an
31823194// edit.
3183- const midComposition = ( ) =>
3184- composerOpen ||
3185- Boolean ( fabAnchorAt ( ) ) ||
3186- unaccountedGesture ( ) ||
3187- ( document . activeElement ?. tagName === "TEXTAREA" &&
3188- ( document . activeElement . value !== "" ||
3189- document . activeElement . hasAttribute ( "data-lf-offer" ) ) ) ;
3195+ const midComposition = ( ) => {
3196+ const active = focused ( ) ;
3197+ return (
3198+ composerOpen ||
3199+ Boolean ( fabAnchorAt ( ) ) ||
3200+ unaccountedGesture ( ) ||
3201+ ( active ?. tagName === "TEXTAREA" &&
3202+ ( active . value !== "" || active . hasAttribute ( "data-lf-offer" ) ) )
3203+ ) ;
3204+ } ;
31903205// Through the chooser's one door, so the chip opens exactly the version it names. At the
31913206// live root that is an explicit in-place release of the composition hold; on an immutable
31923207// page it is ordinary version travel.
0 commit comments