Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval of this link card waits on a spec decision. No current record governs RichTextEditorToolbar's link UI, so an engineering owner needs to provide or identify the governing spec for the card: when it opens, its Open, Edit and Remove actions, Cmd/Ctrl+K opening Edit, and Cmd/Ctrl-click following links with the text cursor. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. Whatever the decision, these need changes:
- Deleting a link while its Edit form is open leaves the form mounted but hidden, and no other link shows a card until Cmd/Ctrl+K is pressed in another link (
LinkCard.tsx, theediting ?? found.targetprecedence). - The card handles Escape with its own
onKeyDowninstead of joining the shared dismissal stack (useLayerDismissal), whichfamily:overlay-dismissalFR1 requires of every Escape-dismissible layered surface. useRootElementkeeps the editor's root element in React state, whicharchitecture:react-component-runtimeINV1 rules out, and theuseLinkTargetupdate listener needs a comment naming what it synchronizes (INV3).- At 2,030 authored lines the change is over the 2,000-line scope limit; splitting out Cmd/Ctrl-click link following would bring it under.
[Automated review]
|
/approve-spec 557e18a |
RichTextEditorToolbar shows a card for a link while the editor is editable: for the link holding the caret while focus is in the editor or the card, or after the pointer rests on a link for 300 ms (it stays 250 ms after the pointer leaves, and while the pointer is over it). It sits under the link's line, start-aligned and kept inside the editor's width, and renders beside the editable text, overlaying the document without reflowing it. It shows the address without its scheme, which opens the link in a new tab, Open in new tab, Edit, Remove, and the follow shortcut. Edit turns it into Text and Link fields applied together as one undo step; new text keeps the link's first run's format and an empty address removes the link but keeps its text. Cmd/Ctrl+K with the caret in a link opens Edit, and Escape in the card returns focus to the editor and keeps the card away until a link is targeted again. In the editable editor, Cmd-click (Ctrl-click off Apple platforms) opens a link, and only the link under the pointer shows a pointer cursor while that key is held. Read-only and disabled editors keep their links as they were, and promptForUrl replaces the card as it replaces the popover. Co-authored-by: Emily Horsman <[email protected]>
RichTextEditorToolbar's Link button, and Cmd/Ctrl+K in the editor, open a non-modal Popover anchored to the button instead of a modal Dialog. It holds one plain-text URL field (URL keyboard, URL autocomplete, no spellcheck, a placeholder) and Apply, Remove (when the selection is in a link), and Cancel icon buttons with tooltips. Enter applies; Escape or Cancel closes it and returns focus and the selection to the editor; a URL that cannot be linked shows the field's error status and keeps focus in the field. The URL rules, hasNewTabLinks, promptForUrl, and the Cmd/Ctrl+K shortcut are unchanged. RICHTEXT_ICON_KEYS gains applyLink, removeLink, and cancel with bundled fallbacks, and the catalog gains the field's placeholder. Co-authored-by: Emily Horsman <[email protected]>
b185b1d to
17e0459
Compare
557e18a to
9277ad4
Compare
There was a problem hiding this comment.
Approval of this link card still waits on a spec decision: no current record governs RichTextEditorToolbar's link UI, and the earlier /approve-spec named a previous head, so it no longer applies after the rebase. An engineering owner needs to provide or identify the governing spec, or record the decision on the current head by commenting /approve-spec <full head SHA> (the author may do so if they are an engineering owner), covering when the card opens, its Open, Edit and Remove actions, Cmd/Ctrl+K opening Edit, Cmd/Ctrl-click following with the text cursor, and the new openLink and editLink icon keys. Whatever the decision, these still need changes:
- Deleting a link while its Edit form is open leaves the form mounted but hidden, and no other link shows a card until Cmd/Ctrl+K is pressed in another link (
LinkCard.tsx, theediting ?? found.targetprecedence). - The card handles Escape with its own
onKeyDowninstead of joining the shared dismissal stack throughuseLayerDismissal, whichfamily:overlay-dismissalFR1 requires. useRootElementkeeps the editor root in React state (architecture:react-component-runtimeINV1); attaching the root listeners insideregisterRootListeneravoids that, and the remaining state-setting Effects need a comment naming what they synchronize (INV3).- The changeset says Cmd/Ctrl-click opens links "in an editable editor", but it only does where the toolbar's link card is mounted.
- At 2,030 authored lines the change is over the 2,000-line limit; splitting out Cmd/Ctrl-click following would bring it under.
[Automated review]
|
/approve-spec 9277ad4 |
There was a problem hiding this comment.
Changes requested. The engineering owner's /approve-spec settles the link card's direction, so what remains are these fixes:
- Deleting a link while its Edit form is open leaves the form mounted but hidden, and no other link shows a card until Cmd/Ctrl+K is pressed in another link (
LinkCard.tsx, theediting ?? found.targetprecedence). - The card handles Escape with its own
onKeyDowninstead of joining the shared dismissal stack throughuseLayerDismissal, whichfamily:overlay-dismissalFR1 requires. - Newly live check: container scroll and window resize re-run
measure()every frame, so the card reads layout on the scroll and resize path thatarchitecture:react-component-runtimeINV18 keeps free of layout reads; place it with CSS anchor positioning or measure once per target change. - Newly live check: desktop behavior change needs an owner decision, because resting the mouse on a link opens the card, Cmd/Ctrl-click opens the link and links show the text cursor (
LinkCard.tsxhover and follow listeners,editorTheme.tslink cursor); gate it to touch input or cite the decision in the description. useRootElementkeeps the editor root in React state (architecture:react-component-runtimeINV1); attach the root listeners insideeditor.registerRootListenerand keep only a render key in state.- Miss: the Effect that marks the link under the pointer while Cmd/Ctrl is held defers the keypress's work (INV2), which the existing window key and mouse handler can do itself.
- Miss: the card's re-measure copies the reposition scheduler of the code block headers and task checkboxes and already differs from them, so call one shared scheduler instead.
- The update-listener and window-listener Effects need a comment naming what they synchronize, and the Edit form's frame-delayed focus needs one saying why it waits (INV3).
- The changeset says Cmd/Ctrl-click opens links "in an editable editor", but it only does where the toolbar's link card is mounted.
- At 2,030 authored lines the change is over the 2,000-line limit; splitting out Cmd/Ctrl-click following would bring it under.
[Automated review]
…TextInput hints, and opens above the toolbar - Apply and Cancel draw the shared check and close icons, so a theme restyles them through icons; Remove draws fixed artwork. The form adds no richtext:* icon key. - The Popover's own focus handling moves focus to the URL field; the field's URL keyboard and spelling hints use TextInput's props. - Cmd/Ctrl+K brings the Link button into view before the popover opens. - The popover opens above the toolbar and flips below only when there is no room, so it does not cover the editor's first lines. - A RichTextEditorToolbar record holds the link control's contract.
…llIntoView does not stop the popover
Resolves RichTextEditorToolbar.tsx (the link prop's doc keeps the popover text and adds main's #9668 caret insertion) and RichTextEditor.test.tsx (imports from both sides). The popover's apply path is main's single update, which inserts the URL as link text at a collapsed caret. Co-authored-by: ernestt <[email protected]>
…s the empty field and its placeholder Apply and Cancel use the shared check and close icons and RICHTEXT_ICON_KEYS is unchanged, so the changeset no longer claims new icon keys. It also names the placement: above the toolbar, below only without room. Co-authored-by: ernestt <[email protected]>
…t the button's name; the record's compatibility row is present tense Button on main no longer describes itself by a tooltip that repeats its name, so tooltipOf falls back to the tooltip layer's text. Co-authored-by: ernestt <[email protected]>
Resolves RichTextEditorToolbar.tsx (LinkCard still draws the applyLink, removeLink and cancel glyphs, so their keys stay for now) and the toolbar's Chromium spec (imports from @astryxdesign/a11y-spec/playwright, as main's specs do). Co-authored-by: ernestt <[email protected]>
Behavior-neutral. The toolbar's link popover state and actions move to useToolbarLink and ToolbarLinkPopover in ToolbarLinkPopover.tsx, with isInsertLink. The URL form moves to linkForm.tsx as LinkForm, and the address rule to linkEditing.ts as toLinkHref. The toolbar exports its inline formats, their labels, the formats a selection carries, the format command, and its glyph resolver for other RichText modules. The package entry exports none of it. Co-authored-by: Ernest Tien <[email protected]>
…nkPopoverPlugin The card RichTextEditorToolbar drew for every link is now a plugin a caller passes through plugins (AST-106 FR10); without it, links behave as before. The caret in a link opens its popover; Cmd/Ctrl-click opens the link in a new tab; hovering does nothing (the owner's LP1 answer). Edit shows the toolbar's own link form, moved to linkForm.tsx so both callers render it, and links are set through linkEditing.ts. Escape joins the layer dismissal stack, the popover is placed once per link and through the shared reposition scheduler (editorReposition.ts, now also used by the code block headers and task checkboxes) with no scroll reads, the root element stays out of React state, and focus and drag tracking is the shared useEditorFocusAndDrag hook. A link deleted while its form is open closes the form. The new-tab cursor rules and the Text field are gone, and no richtext icon keys are added. Co-authored-by: ernestt <[email protected]>
There was a problem hiding this comment.
Approval waits on an engineering owner decision, and several fixes are needed whatever that decision is.
spec:AST-106 (its Link popover row and DEC-4) covers the opt-in plugin, opening for the caret's link, Edit and Remove, and Cmd/Ctrl-click. It does not settle what the draft component:RichTextEditorLinkPopoverPlugin record and the new AST-106 verification rows add: the address format, placement under the caret's line, Escape keeping the popover closed, Cmd/Ctrl+K routing in a link, the public rows RichTextEditorLinkPopoverPlugin, RichTextEditorLinkPopoverPluginProps and hasNewTabLinks, and the shared modules editorReposition.ts, linkEditing.ts and linkForm.tsx. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, or names current records that settle it; the author may do so if they are an engineering owner.
Blocking findings:
- Open in new tab has no keyboard path: Tab in a link types a tab and Escape closes the popover before Tab can reach it, which AST-106 FR7 rules out, and the draft record's AR1 says Tab reaches it.
- After Edit, clicking elsewhere on the page and then into plain text brings the old link's form back and moves focus into its field, because
editingis masked rather than cleared (RichTextEditorLinkPopoverPlugin.tsx:363-369). - Script keeps the popover on its link after every editor update, root resize and window resize, which
architecture:layer-runtimeINV21 rules out, and the resize-path layout reads also breakarchitecture:react-component-runtimeINV18; CSS anchor positioning is the expected route. editorReposition.ts,linkEditing.tsandlinkForm.tsxare new shared internal modules that no current record names, so each needs an owner API decision that says why existing modules are not enough.- At 2,964 authored lines, 1,158 of them the separable toolbar extraction from #11189, the change is over the 2,000-line limit: land #11189 into the base first, or declare the stack, and merge
maininto the base branch. - The three new public rows are outside the declared scope because the title's
richtextnames no component: addComponents: RichTextEditorLinkPopoverPluginunder## Scope, or split them out. useToolbarLink's new Effect does not name the system it synchronizes (ToolbarLinkPopover.tsx:146-162,architecture:react-component-runtimeINV3).- The extraction changeset says the inline-format helpers move into shared modules, but they stay in
RichTextEditorToolbar.tsxand nothing else imports them: fix the wording or drop those exports.
| const editingTarget = | ||
| editing != null && | ||
| isEditable && | ||
| isFocusWithin && | ||
| isLinkKey(editor, editing.key) | ||
| ? editing | ||
| : null; |
There was a problem hiding this comment.
editing is masked here while focus is outside the editor, but never cleared. After Edit, a click elsewhere on the page and then a click into plain text brings this link's form back, and LinkForm moves focus into its field (Chromium: the field holds the old address and has focus). Could the focusout that leaves the frame, and the update listener when the edited key stops being a link, clear editing instead, with a test that blurs and refocuses?
| {isOpenable && ( | ||
| <IconButton | ||
| label={openLabel} | ||
| icon={<Icon icon="externalLink" />} | ||
| variant="ghost" | ||
| size={SIZE} | ||
| tooltip={openLabel} | ||
| onClick={() => openLinkInNewTab(url)} | ||
| /> | ||
| )} |
There was a problem hiding this comment.
This action has no keyboard path: Tab with the caret in a link types a tab (the editor binds Tab to indentation), and Escape closes the popover before the editor's Escape-then-Tab exit, so the next Tab leaves the editor. Cmd/Ctrl+K reaches Edit and Remove but not Open. spec:AST-106 FR7 asks for a keyboard path to every pointer action; a shortcut that moves focus into the popover would cover all of them.
| useEffect( | ||
| () => | ||
| targetKey == null | ||
| ? undefined | ||
| : registerEditorReposition(editor, () => applyPlace(measure())), | ||
| [applyPlace, editor, measure, targetKey], | ||
| ); |
There was a problem hiding this comment.
This keeps the popover on its link by script: after each editor update, root resize and window resize it re-reads getClientRects, getBoundingClientRect and offsetWidth and rewrites top and left. architecture:layer-runtime INV21 asks anchored layers to follow their anchor through CSS anchor positioning only, and the per-frame reads during a window resize break architecture:react-component-runtime INV18. Could the targeted link carry an anchor name and the popover use position-anchor with position-try for the edges?
Co-authored-by: Ernest Tien <[email protected]>
Takes #8718's shared link popover, URL form, and inline-format helpers (from #11189) in place of this branch's own extraction, and its useEditorFocusAndDrag in place of this toolbar's own focus and drag tracking. Table selections read their formats here, since the shared helper covers range and node selections. Co-authored-by: Ernest Tien <[email protected]>
…ales Button scales on press, so the open popover moved with a press on the Link button it anchored to (layer-runtime INV22). It now anchors to a wrapper around the button; Popover finds the button inside for its handlers and ARIA. Co-authored-by: ernestt <[email protected]>
Takes #8717's non-scaling wrapper around the toolbar's Link button: ToolbarLinkPopover anchors to that wrapper, and useToolbarLink's option, which scrolls the button into view, is now buttonRef. Co-authored-by: Ernest Tien <[email protected]>
…into richtext-link-card Co-authored-by: ernestt <[email protected]>
There was a problem hiding this comment.
Approval waits on an engineering owner decision, and several fixes are needed whatever that decision is.
spec:AST-106 (its Link popover row and DEC-4) covers the opt-in plugin, opening for the caret's link, Edit and Remove, and Cmd/Ctrl-click. It does not settle what the draft component:RichTextEditorLinkPopoverPlugin record and the new AST-106 verification rows add: the address format, placement under the caret's line, Escape keeping the popover closed, Cmd/Ctrl+K routing in a link, the public rows RichTextEditorLinkPopoverPlugin, RichTextEditorLinkPopoverPluginProps and hasNewTabLinks, and the shared modules editorReposition.ts, linkEditing.ts and linkForm.tsx. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, or names current records that settle it; the author may do so if they are an engineering owner.
Blocking findings:
- Open in new tab has no keyboard path: Tab in a link types a tab and Escape closes the popover before Tab can reach it, which AST-106 FR7 rules out, and the draft record's AR1 says Tab reaches it.
- After Edit, clicking elsewhere on the page and then into plain text brings the old link's form back and moves focus into its field, because
editingis masked rather than cleared (RichTextEditorLinkPopoverPlugin.tsx:363-369). - Script keeps the popover on its link after every editor update, root resize and window resize, which
architecture:layer-runtimeINV21 rules out, and the resize-path layout reads also breakarchitecture:react-component-runtimeINV18; CSS anchor positioning is the expected route. editorReposition.ts,linkEditing.tsandlinkForm.tsxare new shared internal modules that no current record defines, so each needs an owner API decision that says why existing modules are not enough (architecture:knowledge-contractsDEC-22).- At 2,966 authored lines, 1,160 of them the separable toolbar extraction from #11189, the change is over the 2,000-line limit: land #11189 into the base first, or declare the stack, and merge
maininto the base branch. - The three new public rows are outside the declared scope because the title's
richtextnames no component: addComponents: RichTextEditorLinkPopoverPluginunder## Scope, or split them out. - Miss: the plugin rebuilds the Cmd/Ctrl+K test (
RichTextEditorLinkPopoverPlugin.tsx:72,:451) instead of callingisInsertLinkfromToolbarLinkPopover.tsx, so the two shortcut rules can drift apart. - The extraction changeset says the inline-format helpers move into shared modules, but they stay in
RichTextEditorToolbar.tsxand nothing else imports them: fix the wording or drop those exports.
useToolbarLink's Effect now names the system it syncs with, so that earlier point is resolved.
| editor.registerCommand( | ||
| KEY_DOWN_COMMAND, | ||
| event => { | ||
| if (!isExactShortcutMatch(event, 'k', PRIMARY_MODIFIER)) { |
There was a problem hiding this comment.
Miss from the last review: this rebuilds the Cmd/Ctrl+K test that isInsertLink in ToolbarLinkPopover.tsx (lines 54-56) already exports, with its own PRIMARY_MODIFIER copy of CONTROL_OR_META (line 72). If the toolbar's shortcut rule changes, Cmd/Ctrl+K in a link keeps the old one. Could this call isInsertLink(event) and drop PRIMARY_MODIFIER?
Takes #8717's non-scaling wrapper anchor and useToolbarLink's buttonRef. The selection toolbar's Link button gets the same wrapper, so its link popover anchors to a box a press never scales. Co-authored-by: Ernest Tien <[email protected]>
Brings in #11177 (Popover focus entry in document order). Co-authored-by: ernestt <[email protected]>
With Popover's focus entry taking the first content control in document order (#11177), the form no longer turns hasAutoFocus off and focuses its field from an Effect. The record drops FR4's slot-system status line and says AST-061 owns the toolbar's props; the link anchor styles no longer split the Divider comment from its styles. Co-authored-by: ernestt <[email protected]>
Takes #8717's removal of the form's focus Effect and of hasAutoFocus={false}: Popover's focus entry focuses the URL field. In this branch that code lives in linkForm.tsx and ToolbarLinkPopover.tsx. Co-authored-by: Ernest Tien <[email protected]>
…ge) into richtext-link-card LinkForm no longer focuses its field from an Effect, since the toolbar's Popover focuses it. The plugin's popover is no Popover, so LinkForm gains hasAutoFocus (TextInput's own) and the plugin's Edit view sets it. Co-authored-by: ernestt <[email protected]>
There was a problem hiding this comment.
Approval waits on an engineering owner decision, and several fixes are needed whatever that decision is.
spec:AST-106 (its Link popover row and DEC-4) covers the opt-in plugin, opening for the caret's link, Edit and Remove, and Cmd/Ctrl-click. It does not settle what the draft component:RichTextEditorLinkPopoverPlugin record and the five new AST-106 verification rows add: the address format, placement under the caret's line, Escape keeping the popover closed, Cmd/Ctrl+K routing in a link, the public rows RichTextEditorLinkPopoverPlugin, RichTextEditorLinkPopoverPluginProps and hasNewTabLinks, and the shared modules editorReposition.ts, linkEditing.ts and linkForm.tsx. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, or names current records that settle it; the author may do so if they are an engineering owner.
Blocking findings:
- Open in new tab has no keyboard path: Tab in a link inserts a tab and Escape closes the popover before Tab can reach it, which AST-106 FR7 rules out (
RichTextEditorLinkPopoverPlugin.tsx:247-255). - After Edit, a click outside the editor and then into plain text brings the old link's form back with its old address, and its buttons still act on that link, because
editingis hidden rather than cleared (RichTextEditorLinkPopoverPlugin.tsx:365-371). - Script keeps the popover on its link after every editor update, root resize and window resize (
RichTextEditorLinkPopoverPlugin.tsx:469-513), whicharchitecture:layer-runtimeINV21 rules out and whose resize-path layout reads breakarchitecture:react-component-runtimeINV18; CSS anchor positioning is the expected route. editorReposition.ts,linkEditing.tsandlinkForm.tsxare new shared internal modules that no current record defines, so each needs an owner API decision that says why existing modules are not enough (architecture:knowledge-contractsDEC-22).- At 2,963 authored lines, 1,148 of them #11189's separable toolbar extraction, the change is over the 2,000-line limit: land #11189 into the base branch first, or retarget this pull request onto #11189's branch.
- The three new public rows are outside the declared scope because the title's
richtextnames no component: addComponents: RichTextEditorLinkPopoverPluginunder## Scope, or split them out. - Miss: the plugin rebuilds the Cmd/Ctrl+K test (
RichTextEditorLinkPopoverPlugin.tsx:72,:453) instead of callingisInsertLinkfromToolbarLinkPopover.tsx, so the two shortcut rules can drift apart. - The extraction changeset says the inline-format helpers move into shared modules, but they stay in
RichTextEditorToolbar.tsxand nothing else imports them: fix the wording or drop those exports.
| const editingTarget = | ||
| editing != null && | ||
| isEditable && | ||
| isFocusWithin && | ||
| isLinkKey(editor, editing.key) | ||
| ? editing | ||
| : null; |
There was a problem hiding this comment.
Rechecked at this head: editing is still hidden here while focus is outside the editor, but never cleared. After Edit, a click outside the editor and then a click in plain text shows this link's form again under the link, with the old address. The field no longer takes focus: the caret stays in the plain text, typing goes into the text, and the form stays, while Update and Remove still act on the old link. Could the focusout that leaves the frame, and the update listener when the edited key stops being a link, clear editing, with a blur-and-refocus test?
Retargets the link popover plugin onto main after its parents (#8717, #11189) merged as squashes. The branch keeps only its own changes over the parents' merged state: the plugin, its record, story, tests and Chromium spec; the shared reposition scheduler and the focus-and-drag hook; and their uses in the task-checkbox and code-block header plugins, which main moved under internal/. The parents' copies of their own files and changesets give way to main's. Main's React lint rules now cover the plugin: its click and focus listeners attach through module functions that return their own cleanup, and the popover's layout-measured place keeps its set in a layout effect with a reason.
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
Approval waits on an engineering owner decision, and seven fixes are needed whatever that decision is.
spec:AST-106 (its Link popover row and DEC-4) covers the opt-in plugin, opening for the caret's link, Edit, Remove and Cmd/Ctrl-click. It does not settle what the draft component:RichTextEditorLinkPopoverPlugin record and the five new AST-106 verification rows add (the address format, placement under the caret's line, Escape keeping the popover closed, Cmd/Ctrl+K routing in a link, the three strings) or the public rows RichTextEditorLinkPopoverPlugin, RichTextEditorLinkPopoverPluginProps and hasNewTabLinks. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, or names current records that settle it; the author may do so if they are an engineering owner.
Blocking findings:
- Open in new tab and the address link have no keyboard path, because Tab types a tab into the link and Escape closes the popover before the editor's Escape-then-Tab exit, which
spec:AST-106FR7 rules out (RichTextEditorLinkPopoverPlugin.tsx:229-256). - After Edit, a click outside the editor and then into plain text brings the old link's form back with its old address while typing goes into the text, because
editingis hidden rather than cleared (RichTextEditorLinkPopoverPlugin.tsx:394-400). - Script keeps the popover on its link after every editor update and resize (
RichTextEditorLinkPopoverPlugin.tsx:478-493,:517-523), whicharchitecture:layer-runtimeINV21 andarchitecture:react-component-runtimeINV18 rule out, so CSS anchor positioning is the expected route. editorReposition.tsis a new internal shared module, imported by the code block header and task checkbox plugins, that no current record names, so it needs an owner API decision showing its usage and whyobserveResizeand the existing modules are not enough (architecture:knowledge-contractsDEC-22).- Miss: the plugin rebuilds the Cmd/Ctrl+K test (
RichTextEditorLinkPopoverPlugin.tsx:72,:462) instead of callingisInsertLinkfrominternal/ToolbarLinkPopover.tsx, so the two shortcut rules can drift apart. - The three new public rows are outside the declared scope because the title's
richtextnames no component, so addComponents: RichTextEditorLinkPopoverPluginunder## Scopeor split them out. - Several description and changeset claims no longer hold at this head (the reach of DEC-4, the test, suite and line counts, the toolbar size, other users of
useEditorFocusAndDrag.ts, "without its scheme" for mailto and tel links, and which message descriptions mention the plugin), so please update them.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Changeset: an opt-in plugin passed through
plugins: verified (index.ts:59-60; every unit case mounts it throughplugins). - Changeset: with the caret in a link and focus in the editor, a popover under the line shows the address, Open in new tab, Edit and Remove: verified (Chromium at 1280 and 390 px; unit cases).
- Changeset: the address shows without its scheme: false for mailto and tel: only http and https are stripped (
linkEditing.ts:114-116). - Changeset: Edit, or Cmd/Ctrl+K in a link, shows the toolbar's link form; an empty address removes the link and keeps its text: verified (unit cases).
- Changeset: Escape closes the popover; it overlays without reflow and renders beside the editable text: verified (Chromium probe; unit placement case).
- Changeset: without the plugin nothing changes; only http, https, mailto and tel addresses open: verified (unit cases; editor-plus-toolbar page 14 bytes smaller).
- Messages changeset: three new messages; reused link messages keep their text and their descriptions now mention the plugin: partly false: the cancel and update descriptions do not mention the plugin (
en.json). - Description: a click or arrowing into a link shows the popover; hover does nothing; Cmd/Ctrl-click opens a new tab: verified (unit cases; Chromium hover probe).
- Description: one new export plus its props type with
hasNewTabLinksdefaulting to true like the toolbar's; no other component prop changes: verified (diff;RichTextEditorToolbar.tsx:583). - Description: the governing decision covers the link under the pointer and the public surface: false: current AST-106 and its DEC-4 cover the caret and Cmd/Ctrl-click only and say nothing about public API.
- Description: the draft record covers events, placement, dismissal and four internal modules: verified (draft record).
- Description: Escape uses the shared dismissal stack; no root element in state; no deferred keypress Effect; every Effect names its system: verified (
RichTextEditorLinkPopoverPlugin.tsx:538-542,:386-388, Effects at:414,:439,:457,:517). - Description: no layout reads on scroll: verified for scroll; reads remain on the resize path (finding 3).
- Description: a link deleted while its form is open closes the form: verified (unit case).
- Description: one shared scheduler replaces the two plugin copies and never listens to scroll: verified (
editorReposition.ts; both plugins' diffs). - Description: the selection format bar also uses the focus-and-drag hook: false at this head: only the plugin imports it.
- Description: the original card's hover-open, link cursor, Text field and two icon keys are gone; Open uses the shared external-link icon: verified (diff).
- Description: the earlier review's ten items are addressed: verified for 1, 2, 4–8 and 10; 3 holds for scroll but not resize (finding 3); 9 partly false (changeset wording).
- Description: about +1,920 / −230 lines: stale: +1,771 / −83 against
main. - Description: toolbar 5.7 to 5.9 KB gzip; plugin 4.2 KB: not reproduced at this head: the editor-plus-toolbar page shrinks by 14 bytes gzip and the plugin adds 2,552 bytes gzip where imported.
- Description: 21 plugin test cases; richtext suite 47 files, 787 tests: stale: 22 cases; 51 files, 846 tests, all passing.
- Description: the public-surface test lists the export; a Chromium spec checks placement, hover and Escape at 1280 and 390 px: verified (test passes; the spec did not run in CI, and the same states pass in this review's Chromium probes).
- Description: writing rubric results reported with no project status in the records: verified.
Files:
.changeset/richtext-link-popover-plugin-messages.md: finding 7 (cancel and update descriptions)..changeset/richtext-link-popover-plugin.md: finding 7 (scheme wording).apps/storybook/stories/RichTextEditor.stories.tsx: clear.docs/specs/AST-106-richtext-document-affordances/spec.md: owner decision (five new rows).docs/specs/components/RichTextEditorLinkPopoverPlugin/RichTextEditorLinkPopoverPlugin.spec.md: owner decision; AR1's Tab claim does not hold (finding 1).packages/core/locales/en.json: owner decision on the three strings; finding 7.packages/richtext/src/RichTextEditor.doc.mjs: clear.packages/richtext/src/RichTextEditor.test.tsx: clear.packages/richtext/src/RichTextEditorLinkPopoverPlugin.test.tsx: clear.packages/richtext/src/RichTextEditorLinkPopoverPlugin.tsx: findings 1, 2, 3 and 5; comment suggestions.packages/richtext/src/__tests__/RichTextEditorLinkPopoverPlugin.a11y.chromium.spec.ts: clear.packages/richtext/src/editorReposition.ts: finding 4.packages/richtext/src/index.ts: finding 6 (out-of-scope rows).packages/richtext/src/internal/CodeBlockHeaderPlugin.tsx: clear (same scheduler code, now shared).packages/richtext/src/internal/TaskCheckboxPlugin.tsx: clear (same scheduler code, now shared).packages/richtext/src/linkEditing.ts: clear.packages/richtext/src/linkForm.tsx: clear.packages/richtext/src/linkUtils.ts: clear.packages/richtext/src/publicSurface.test.ts: clear.packages/richtext/src/useEditorFocusAndDrag.ts: clear (private to the plugin).
| "Link"; every control in it is named and has a tooltip, and Tab from the | ||
| editable text reaches it, since it follows the text in the document. |
There was a problem hiding this comment.
In Chromium this Tab path does not exist: with the caret in a link, Tab types a tab into the link (the editor binds Tab to indentation), and Escape closes the popover on the same press that arms the editor's Escape-then-Tab exit, so the next Tab leaves the editor. spec:AST-106 FR7 needs a keyboard route to the address and Open in new tab; once the plugin has one, could AR1 describe it?
| '@astryxdesign/richtext': patch | ||
| --- | ||
|
|
||
| [feat] New opt-in `RichTextEditorLinkPopoverPlugin`, passed through `RichTextEditor`'s `plugins` prop. With the caret in a link while the editor has focus, it shows a popover under the link's line: the address without its scheme (which opens the link in a new tab), then Open in new tab, Edit, and Remove. Edit, or Cmd/Ctrl+K with the caret in a link, shows the same link form as the toolbar's link popover; an empty address removes the link and keeps its text. Escape closes the popover. The popover overlays the document without reflowing it and renders beside the editable text, not inside it. Without the plugin, nothing changes. Only addresses with an `http`, `https`, `mailto`, or `tel` scheme open. |
There was a problem hiding this comment.
"the address without its scheme" holds only for http and https: displayUrl (linkEditing.ts:114-116) keeps mailto: and tel:. Could this say "without its web scheme", as the record's FR2 does?
| return IS_APPLE ? event.metaKey : event.ctrlKey; | ||
| } | ||
|
|
||
| /** The popover's control size. */ |
There was a problem hiding this comment.
Non-blocking (INV29): this comment and the one on LinkTarget (line 139) restate the names they sit on; dropping both keeps the file to comments that give a reason.
|
/approve-spec 5f7dbad |
There was a problem hiding this comment.
Changes requested. An engineering owner's approval of this head settles the spec direction for the link popover plugin (its record, the new spec:AST-106 verification rows, the strings and the public exports), so what remains are these fixes.
Blocking findings:
- Open in new tab and the address link have no keyboard path, because Tab types a tab into the link and Escape closes the popover before the editor's Escape-then-Tab exit, which
spec:AST-106FR7 rules out (RichTextEditorLinkPopoverPlugin.tsx:229-256). - After Edit, a click outside the editor and then into plain text brings the old link's form back with its old address while typing goes into the text, because
editingis hidden rather than cleared (RichTextEditorLinkPopoverPlugin.tsx:394-400). - Script keeps the popover on its link after every editor update and resize (
RichTextEditorLinkPopoverPlugin.tsx:478-493,:517-523), whicharchitecture:layer-runtimeINV21 andarchitecture:react-component-runtimeINV18 rule out, so CSS anchor positioning is the expected route. component:RichTextEditorToolbarFR3 still says Cmd/Ctrl+K in the editor opens the toolbar's popover while the plugin now takes Cmd/Ctrl+K with the caret in a link (RichTextEditorLinkPopoverPlugin.tsx:457-476), so please amend that record for the plugin-on case.- Miss: the plugin rebuilds the Cmd/Ctrl+K test (
RichTextEditorLinkPopoverPlugin.tsx:72,:462) instead of callingisInsertLinkfrominternal/ToolbarLinkPopover.tsx, so the two shortcut rules can drift apart. - The three new public rows are outside the declared scope because the title's
richtextnames no component, so addComponents: RichTextEditorLinkPopoverPluginunder## Scopeor split them out. - Several description and changeset claims do not hold at this head (the DEC-4 quote "under the pointer", the test, suite and line counts, the toolbar size, other users of
useEditorFocusAndDrag.ts, "without its scheme" for mailto and tel links, and which message descriptions mention the plugin), so please update them.
The shared-module question about editorReposition.ts from the last review is settled by the approved record.
Claims and files checked
Review mode: same-head; reason: none
Rules changed since the last review:
- Incremental re-review procedure: checked: the two review configurations and this pull request's review history, no finding.
- Review mode line: checked: the same, no finding.
Claims:
- Changeset: an opt-in plugin passed through
plugins: verified (index.ts:59-60; every unit case mounts it throughplugins). - Changeset: with the caret in a link and focus in the editor, a popover under the line shows the address, Open in new tab, Edit and Remove: verified (Chromium at 1280 and 390 px; unit cases).
- Changeset: the address shows without its scheme: false for mailto and tel, since only http and https are stripped (
linkEditing.ts:114-116). - Changeset: Edit, or Cmd/Ctrl+K in a link, shows the toolbar's link form, and an empty address removes the link and keeps its text: verified (unit cases).
- Changeset: Escape closes the popover, which overlays without reflow beside the editable text: verified (Chromium probe; unit placement case).
- Changeset: without the plugin nothing changes, and only http, https, mailto and tel addresses open: verified (unit cases; the editor-plus-toolbar page is 14 bytes smaller).
- Messages changeset: three new messages: verified (
en.json). - Messages changeset: the reused link message descriptions now mention the plugin: false for the URL label, Cancel and Update descriptions (
en.json). - Description: a click or arrowing into a link shows the popover, hover does nothing, and Cmd/Ctrl-click opens a new tab: verified (unit cases; Chromium hover probe).
- Description: one new export plus its props type,
hasNewTabLinksdefaulting to true like the toolbar's, and no other component prop changes: verified (diff;RichTextEditorToolbar.tsx:583). - Description: the governing decision opens, edits or removes the link at the caret or under the pointer: false, since the governing record reads "at the caret" only.
- Description: the decision also covers the public surface: verified through the owner's approval of this head's record, which states the public contract.
- Description: the new record covers events, placement, dismissal and four internal modules: verified (record).
- Description: Escape uses the shared dismissal stack, no root element is kept in state, no keypress work is deferred to an Effect, and every Effect names its system: verified (
RichTextEditorLinkPopoverPlugin.tsx:538-542,:388, Effects at:414,:439,:457,:517). - Description: no layout reads on scroll: verified for scroll; reads remain on the resize path (finding 3).
- Description: a link deleted while its form is open closes the form: verified (unit case).
- Description: one shared scheduler replaces the two plugin copies and never listens to scroll: verified (
editorReposition.ts; both plugins' diffs). - Description: the selection format bar also uses the focus-and-drag hook: false at this head, since only the plugin imports it.
- Description: the original card's hover-open, link cursor, Text field and two icon keys are gone, and Open uses the shared external-link icon: verified (diff).
- Description: the earlier review's ten items are addressed: verified for 1, 2, 4 to 8 and 10; 3 holds for scroll but not resize; 9 is false (changeset wording).
- Description: about +1,920 / −230 lines: stale, +1,771 / −83 against
main. - Description: toolbar 5.7 to 5.9 KB gzip and plugin 4.2 KB: not reproduced, since the editor-plus-toolbar page shrinks by 14 bytes gzip and the plugin adds 2,552 bytes gzip where imported.
- Description: 21 plugin test cases and a richtext suite of 47 files and 787 tests: stale, 22 cases and 51 files with 846 tests, all passing.
- Description: the public-surface test lists the export, and a Chromium spec checks placement, hover and Escape at 1280 and 390 px: verified (the spec did not run in CI; the same states pass in the review's Chromium probes).
- Description: writing rubric results reported, with no project status in the records: verified.
Files:
.changeset/richtext-link-popover-plugin-messages.md: finding 7 (descriptions)..changeset/richtext-link-popover-plugin.md: finding 7 (scheme wording).apps/storybook/stories/RichTextEditor.stories.tsx: clear.docs/specs/AST-106-richtext-document-affordances/spec.md: clear (owner-approved rows).docs/specs/components/RichTextEditorLinkPopoverPlugin/RichTextEditorLinkPopoverPlugin.spec.md: AR1's Tab claim does not hold (finding 1).packages/core/locales/en.json: finding 7 (descriptions).packages/richtext/src/RichTextEditor.doc.mjs: clear.packages/richtext/src/RichTextEditor.test.tsx: clear.packages/richtext/src/RichTextEditorLinkPopoverPlugin.test.tsx: clear.packages/richtext/src/RichTextEditorLinkPopoverPlugin.tsx: findings 1 to 5; comment suggestions.packages/richtext/src/__tests__/RichTextEditorLinkPopoverPlugin.a11y.chromium.spec.ts: clear.packages/richtext/src/editorReposition.ts: clear (named by the approved record).packages/richtext/src/index.ts: finding 6 (out-of-scope rows).packages/richtext/src/internal/CodeBlockHeaderPlugin.tsx: clear (same scheduler code, now shared).packages/richtext/src/internal/TaskCheckboxPlugin.tsx: clear (same scheduler code, now shared).packages/richtext/src/linkEditing.ts: clear.packages/richtext/src/linkForm.tsx: clear.packages/richtext/src/linkUtils.ts: clear.packages/richtext/src/publicSurface.test.ts: clear.packages/richtext/src/useEditorFocusAndDrag.ts: clear (private to the plugin).
| useEffect( | ||
| () => | ||
| editor.registerCommand( | ||
| KEY_DOWN_COMMAND, | ||
| event => { | ||
| if (!isExactShortcutMatch(event, 'k', PRIMARY_MODIFIER)) { | ||
| return false; | ||
| } | ||
| const link = readCaretLink(editor); | ||
| if (link == null) { | ||
| return false; | ||
| } | ||
| event.preventDefault(); | ||
| setEditing(link); | ||
| return true; | ||
| }, | ||
| COMMAND_PRIORITY_HIGH, | ||
| ), | ||
| [editor], | ||
| ); |
There was a problem hiding this comment.
With the caret in a link this command takes Cmd/Ctrl+K at high priority, so the toolbar's link popover does not open, and the test asserts its Link button stays collapsed. component:RichTextEditorToolbar FR3 still reads "Cmd/Ctrl+K in the editor opens the same popover", and its Behavior row says the same. Could this pull request amend that record for the plugin-on, caret-in-link case, so the two records agree?
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] New messages for the RichText link popover plugin: `@astryx.richTextEditor.linkPopover.label`, `.openInNewTab`, and `.edit`. The descriptions of the `@astryx.richTextEditor.link.*` messages the plugin reuses now mention it; their messages are unchanged. |
There was a problem hiding this comment.
The plugin's form reuses link.url, link.cancel and link.update, but their descriptions do not mention the plugin: link.url still says "the RichTextEditor link popover", and link.cancel and link.update say only "the RichTextEditor link form". Could this say which descriptions changed, or could those three name the plugin's form too?
Primary intent
Add
spec:AST-106's Link popover as an opt-in plugin,RichTextEditorLinkPopoverPlugin, passed throughRichTextEditor's existingpluginsprop. With the caret in a link, a popover under the link's line shows its address (which opens it in a new tab), then Open in new tab, Edit and Remove. Without the plugin, nothing changes.This PR began as @ernestt's link card built into
RichTextEditorToolbar. It is reshaped to the plugin form AST-106 admits (FR10), with the owner's decision on its events. Ernest's commits are kept, and later commits carryCo-authored-by.User or maintainer impact
RichTextEditorLinkPopoverPlugin, plusRichTextEditorLinkPopoverPluginPropswith one prop,hasNewTabLinks(defaulttrue, as the toolbar's). No prop ofRichTextEditor,RichTextVieworRichTextEditorToolbarchanges.Authority
spec:AST-106(current) admits the Link popover row, and DEC-4 decides its events, ("opens, edits, or removes the link at the caret or under the pointer") as a plugin throughplugins(FR10, FR1).The owner's decision on the link popover's events:
The decision also covers the public surface above.
component:RichTextEditorLinkPopoverPlugin(new, draft) records the events, placement, dismissal and the four internal modules, each with why existing code is not enough.family:overlay-dismissalFR1: Escape goes throughuseLayerDismissal.architecture:react-component-runtime:Change and evidence
RichTextEditorLinkPopoverPlugin.tsx(new): the plugin. Caret tracking from the editor state, the popover portaled into the positioned element around the editable text, Edit, Remove, Cmd/Ctrl+K, Cmd/Ctrl-click, Escape through the layer stack. A link deleted while its form is open closes the form.linkForm.tsxandlinkEditing.ts'stoLinkHrefcome from the extraction PR (refactor(richtext): share the toolbar's link popover and format helpers #11189), merged into this branch; this PR adds the plugin's own functions tolinkEditing.ts.linkEditing.ts: setting or removing a link by key.editorReposition.ts: one reposition scheduler, now also used by the code block headers and task checkboxes in place of their copies. It listens to updates and resizes, never scroll.useEditorFocusAndDrag.ts: focus-within and pointer-drag state for chrome beside the text, which the selection format bar (feat(richtext): add a selection toolbar for the editor #8722) also uses.richtext:*icon keys. Open uses core'sexternalLink; Edit and Remove are fixed artwork.RichTextEditor.doc.mjsguidance;WithLinkPopoverPluginstory.Size
linkForm.tsxmove and the toolbar changes are refactor(richtext): share the toolbar's link popover and format helpers #11189's.RichTextEditorToolbargoes 5.7 → 5.9 KB.Testing
RichTextEditorLinkPopoverPlugin.test.tsx(21 cases):hasNewTabLinks={false};Suites: the richtext suite passes (47 files, 787 tests), and
publicSurface.test.tslists the new export.RichTextEditorLinkPopoverPlugin.a11y.chromium.spec.ts(CI's browser leg) at 1280 and 390 px:Stills from that run will be posted here.
Scope
Writing rubric results
Run over
component:RichTextEditorLinkPopoverPluginand the AST-106 rows added: