Repository navigation
feat(RichTextEditor, RichTextEditorToolbar): replace the toolbar's link dialog with an anchored popover - #8717
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| richtext/RichTextEditorToolbar | 🔴 296.3 kB (+11.0 kB) · 454 B CSS (0) | 968 (+95) | — · ✓ · ✓ |
Package size:
- @astryxdesign/core 7.47 MB packed (+142 B); no new dependencies
- @astryxdesign/richtext 233.6 kB packed (+3.6 kB); no new dependencies
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an owner decision. No current spec decides how RichTextEditorToolbar presents link editing, so an owner needs to approve or reject two things and name the record that holds the decision: the non-modal anchored popover, and the field starting empty instead of with https://. That record could be a Design decisions row in a RichText component spec, or a design record. An engineering owner (or a design owner, for a design record) records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are one.
Whatever the decision, two fixes are needed:
- Cmd/Ctrl+K opens the popover at the Link button even when that button is out of view (the scrolled toolbar row at 320–390 px, or a document taller than the window), so the form is never drawn while its field takes focus; please bring the button into view first and add browser cases for both states.
- The new
richtext:applyLink,richtext:removeLinkandrichtext:canceltheme keys add component-owned themeable icons outsideComponentIconSlotMap, whichspec:AST-087FR11 rules out, so please drop them and keep those glyphs unthemed for now.
[Automated review]
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
There was a problem hiding this comment.
Approval waits on an owner decision: no current spec decides how RichTextEditorToolbar presents link editing, so an owner needs to provide or identify the governing record for the anchored non-modal popover, the field starting empty instead of with https://, and Escape or Cancel returning focus and the selection to the editor (for example a Design decisions row in a RichText component spec, or a design record). An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Whatever the decision, these need fixing:
- Cmd/Ctrl+K opens the popover at the Link button even when that button is out of view (scrolled out of the toolbar row at phone widths, or above the window in a long document), so focus moves into a form nobody can see; please bring the button into view first and add browser cases for both states.
ToolbarLinkFormturns off Popover'shasAutoFocusand re-implements it in its own Effect, although Popover already focuses the field in a real browser; please let Popover do it, and if jsdom's selector order breaks the unit tests, make the shared focus helper pick the first control in tree order.TextInputalready hasinputModeandhasSpellCheckprops, so please pass those instead of writing the attributes through a ref.- The new
richtext:applyLink,richtext:removeLinkandrichtext:canceltheme keys add component-owned themeable icons outsideComponentIconSlotMap, whichspec:AST-087FR11 rules out; please drop them and keep those glyphs unthemed for now. - Newly live check: desktop behavior change needs an owner decision, because for mouse and trackpad users the Link button now opens a non-modal popover that a press outside closes (the
PopoverwithisModal={false}inRichTextEditorToolbar.tsx) where it opened a modal form dialog; please gate the change to touch input or cite the owner decision that covers it.
The inline notes on three comments are optional wording suggestions.
[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
There was a problem hiding this comment.
Approval waits on an owner decision: no current spec decides the toolbar's link interaction, so an engineering owner needs to approve or reject the new component:RichTextEditorToolbar record (FR1–FR6, AR1, DD1 and DEC-1: the anchored non-modal popover that a press outside closes, opening above the toolbar, the field starting empty with an example.com placeholder, and Enter, Escape or Cancel returning focus and the selection to the editor), and because mouse and trackpad users get that popover too, the record or description should show where the owner made that desktop decision, in their own words and with when they gave them. An engineering owner records the approval by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Whatever the decision, these need fixing:
ToolbarLinkFormturns off Popover'shasAutoFocusand focuses the field from its own Effect (RichTextEditorToolbar.tsx:510-515,:1183), although Popover's own focus entry focuses that field in a real browser, so please drop both and, for the jsdom tests, make Popover'sfocusFirstContentControltake its matches in tree order..changeset/richtext-link-popover.md:7(and the description) saysRICHTEXT_ICON_KEYSgainsapplyLink,removeLinkandcancel, but the head adds no keys and Remove's glyph is fixed artwork, so please replace that paragraph with what ships (Apply and Cancel follow the sharedcheckandcloseicons) and update the description's placement and record notes.
Please also merge main, which conflicts in RichTextEditorToolbar.tsx and RichTextEditor.test.tsx so CI has not run on this branch, and add the ## Writing rubric results a pull request that adds a record needs; the three inline comment notes are optional wording suggestions.
[Automated review]
| // A URL keyboard on touch screens and no spelling marks under an | ||
| // address. The field stays plain text, so a bare domain reaches | ||
| // the toolbar's own check, which makes it an https link. |
There was a problem hiding this comment.
Optional (INV29): the first sentence restates inputMode="url" and hasSpellCheck={false}. Keeping only the reason reads: "The field stays plain text, so a bare domain reaches the toolbar's own check, which makes it an https link."
| // The field starts from the link's address, or from selected text that | ||
| // already reads as one; otherwise it is empty and shows its placeholder. |
There was a problem hiding this comment.
Optional (INV29): this narrates the setLinkUrl expression below; it can go.
| // Closes the popover and gives the editor back its focus. The editable root | ||
| // takes focus first and Lexical then draws its selection into it, so the | ||
| // selection survives the field having held the page's selection. |
There was a problem hiding this comment.
Optional (INV29): the first sentence restates the name closeLinkPopoverToEditor. Keeping only the reason: "The editable root takes focus first. Lexical then draws its saved selection into it, which the field's focus had replaced."
|
/approve-spec 6626288 |
There was a problem hiding this comment.
Changes requested: an engineering owner approved the new component:RichTextEditorToolbar record at this head, so the popover's direction is settled, and two fixes remain:
ToolbarLinkFormturns off Popover'shasAutoFocusand focuses the URL field from its own Effect (RichTextEditorToolbar.tsx:510-515,:1183), although Popover's own focus entry focuses that field in a real browser, so please drop both and, for the jsdom tests, make Popover'sfocusFirstContentControltake its matches in document order..changeset/richtext-link-popover.md:7(and the description) saysRICHTEXT_ICON_KEYSgainsapplyLink,removeLinkandcancel, but the head adds no keys and Remove's glyph is fixed artwork, so please replace that paragraph with what ships (Apply and Cancel follow the sharedcheckandcloseicons) and update the description's placement,TextInputand record notes.
Please also merge main, which conflicts in RichTextEditorToolbar.tsx and RichTextEditor.test.tsx so CI has not run on this branch, and add the ## Writing rubric results section a pull request that adds a record needs; FR6 could also say that the field starts empty with the example.com placeholder. The approval covers this head only, so the next push needs a fresh /approve-spec <full head SHA> from an engineering owner (the author may do so if they are one).
[Automated review]
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]>
|
/approve-spec aef99c4 |
There was a problem hiding this comment.
Changes requested for one documentation fix; the popover itself is ready. An engineering owner approved the new component:RichTextEditorToolbar record at this head, so the popover's direction is settled, and the two Testing-section counts flagged earlier now match CI.
- Miss:
packages/richtext/src/RichTextEditorToolbar.doc.mjsstill says the Link button "opens an Astryx Dialog" (line 43) and thatpromptForUrl"replaces the built-in Dialog" (line 50), so the docs site and the published package's docs describe the modal dialog this pull request removes; reword both to match the updatedhasLinkandpromptForUrlJSDoc.
Optional: a second press on the open Link button closes the popover without restoring the selection, unlike Escape and Cancel; naming RichTextEditorToolbar in the title's scope would match where the new handlers live; and the earlier inline notes on comment and record wording still apply.
Claims and files checked
- Changeset (richtext): the Link button and Cmd/Ctrl+K open a popover anchored to the button instead of a modal dialog — verified (
RichTextEditorToolbar.tsx:1192-1220; link test file, first and Cmd/Ctrl+K cases) - Changeset (richtext): one URL field applied with Enter, plus Apply, Remove (in a link) and Cancel icon buttons with tooltips — verified (
:543-597; field, buttons, edit and Enter cases) - Changeset (richtext): not modal; Escape or Cancel closes it and returns focus and the selection; a refused URL shows an error under the field, which keeps focus — verified (
:1202; Escape/Cancel and refused-URL cases; Chromium keyboard spec) - Changeset (richtext): URL rules,
hasNewTabLinksandpromptForUrlunchanged; withpromptForUrlno popover opens, as no dialog opened — verified (applyLinkValueunchanged at:838-876; same-tab andpromptForUrlcases) - Changeset (richtext): opens above the toolbar and flips below only without room — verified (
placement="above"at:1209; Popover flips; earlier Chromium frames) - Changeset (richtext): Apply and Cancel use the shared
checkandcloseicons, Remove is fixed artwork,RICHTEXT_ICON_KEYSunchanged — verified (:572,:581,:590; shared-icon case) - Changeset (core): new
urlPlaceholdermessage ("example.com") and reworded descriptions of the other link messages and the toolbar Link label, messages unchanged — verified (en.jsondiff) - Template choice and routing — verified against
docs/contributing/pull-requests.md("Anything else" row) - Writers: no modal or backdrop; opens above, flips below; Escape/Cancel keep the selection; Enter leaves no stray line — verified (tests; the Chromium spec asserts one paragraph)
- Builders: no prop changes;
promptForUrl,hasNewTabLinksandsanitizeUrlunchanged; shared icons, fixed Remove glyph,RICHTEXT_ICON_KEYSunchanged — verified (props diff is JSDoc only) - Problem: the base opens a modal form
Dialogwith one URL field — verified (base side of the diff) - Primary delta:
PopoverwithisModal={false}, sibling mode on the Link button,placement="above",alignment="start"— verified (:1193-1211) - Field: plain-text
TextInputwithinputMode="url",autoComplete="url", spellcheck off and a placeholder — verified (:543-559; field case) - Icon buttons: ghost
IconButtons at the toolbar's size with tooltips — verified (:571-597) - Keys and errors: Enter applies; Escape or Cancel closes and returns focus and the selection; a refused URL keeps focus with the error — verified (tests)
- Supporting: one new message, existing messages reused, a Core changeset; JSDoc,
RichTextEditor.doc.mjs, unit tests, a browser spec and comments updated — verified as stated (the toolbar's own doc file is not among them: blocking finding) - The field starts empty, or from the link's URL or selected text starting with
http— verified (:901-904) aria-haspopup/aria-expandedonly when the button opens the popover — verified (promptForUrlcase)- The popover renders beside the toolbar and follows its trigger in reading order — verified (rendered after the toolbar, inline as a native popover; first link case)
- The author is a design owner — verified (
.github/DESIGNOWNERS) - The new record covers the popover and an engineering owner approved it — verified (record FR1–FR6, DD1, DEC-1; exact-head
/approve-spec;spec-owner-approvalsuccess) - FieldStatus AR1/AR2: assertive live region, no
role="alert",aria-invalidandaria-describedby— verified (record text; refused-URL case) - Internationalization INV1a: every string through the catalog — verified
- Document-surface parity FR9/DEC-2: the popover is in the top layer and does not reflow the document — verified (native popover)
- Selection saved and restored as before; closing focuses the editable root, then Lexical redraws the selection — verified (
:803-836,:944-948) - Field hints passed as
TextInputprops — verified (TextInputtakesinputModeandhasSpellCheck) - Popover's focus entry focuses the field with no form Effect after the merged Popover fix — verified (fix merged;
hasAutoFocusdefault on; field case); the earlier jsdom run without it — not reproduced - The anchor is a wrapper a press never scales — verified (
:1162-1179; first link case assertsanchor-nameon the wrapper only) - At a caret outside a link the URL becomes the link text, in main's single update — verified (
:850-871, unchanged) - Red arm: 12 tests; all fail with the base toolbar, including the Cmd/Ctrl+K
scrollIntoViewcase — test count verified (12) and the base toolbar never callsscrollIntoView; the run itself — not reproduced - The new browser test fails against a base Storybook because the dialog is modal — consistent with the base
Dialog; not run - Before/after screenshots and real-device placement stills — accepted as stated; the named tag and branch exist with those files
WithLinksgains room above andWithLinksNoRoomAboveputs the toolbar at the top — verified (stories diff)- Link test file: 12 passed — verified (CI unit shard 2)
- CI's unit run covers 47 richtext test files and 780 tests, all passing — verified (CI unit shards 1–4)
- Typecheck passes — verified (CI typecheck)
- Lint: 0 errors — verified (CI lint); the 34-warning set matching the base — not reproduced
- Prettier, changeset and repo checks pass — consistent with green CI; not reproduced separately
- The accessibility audit covers 30 RichTextEditor stories, both link stories included, with 0 violations — verified (CI touched-components audit)
- The richtext Chromium suite passes 88 tests, including the new axe-checked test — the new test verified in CI; CI ran 70 of those tests from 5 of the 10 spec files, so the 88 total — not reproduced
- Carry update:
mainmerged without a rebase, conflicts resolved in the toolbar'shasLinkdoc and the test imports; the changeset names what ships;tooltipOfreads the tooltip layer because a tooltip that repeats the name is not a description — verified (merge message; JSDoc at:626-633; Button FR12) - Writing rubric R1–R7 over the new record — verified (Compatibility row, one rejected alternative, no open questions)
Files:
.changeset/richtext-link-popover-messages.md— clear.changeset/richtext-link-popover.md— clearapps/storybook/stories/RichTextEditor.imagePlugin.tsx— clearapps/storybook/stories/RichTextEditor.playground.tsx— clearapps/storybook/stories/RichTextEditor.stories.tsx— cleardocs/specs/components/RichTextEditorToolbar/RichTextEditorToolbar.spec.md— optional wording notespackages/core/locales/en.json— clearpackages/richtext/src/RichTextEditor.doc.mjs— clear; its siblingRichTextEditorToolbar.doc.mjswas not updated (blocking finding)packages/richtext/src/RichTextEditor.test.tsx— clearpackages/richtext/src/RichTextEditorToolbar.tsx— optional notes (second-press close, scope wording, comments)packages/richtext/src/RichTextEditorToolbarLink.test.tsx— clearpackages/richtext/src/__tests__/Playground.a11y.chromium.spec.ts— clearpackages/richtext/src/__tests__/RichTextEditorToolbar.a11y.chromium.spec.ts— clear
…opover Co-authored-by: ernestt <[email protected]>
|
/approve-spec baa459c |
There was a problem hiding this comment.
Changes requested: the link popover and its new component record look right, the record is approved by an engineering owner at this head, and CI now passes here, but one sentence in the description's Testing section still overstates what CI ran.
- The Playwright line says CI's browser legs run all 107 richtext Chromium tests and they pass, but CI on this head ran 102 of them in 8 files, all passing, and never ran
DecoratorPortal.a11y.browser.spec.ts(4 tests) orRichTextCodeLanguages.a11y.chromium.spec.ts(1 test); please say that, or run those two files and report the run.
Only the description needs editing; the code, tests, record and docs need no change. The red test check comes from one node test shard that hit CI's 15-minute limit in tests this change does not touch; a re-run should clear it. The earlier optional notes still apply: a second Link press closes the popover without restoring the selection, the record does not name the tooltips or the URL autocomplete hint, and a few comments can be shortened.
Claims and files checked
- New placeholder message, and the other link message descriptions updated with their messages unchanged: verified in the English catalog.
- Link button and Cmd/Ctrl+K open a non-modal popover anchored to the button, with one URL field, Enter to apply, and Apply, Remove (in a link) and Cancel icon buttons with tooltips: verified in the toolbar source and the new unit tests.
- Escape and Cancel close it and return focus and the selection; a refused URL shows an error under the field and keeps focus: verified by unit tests and by the Chromium test, which passed in CI on this head.
- URL rules, new-tab links and the custom prompt are unchanged, and the custom prompt opens no popover: verified.
- Opens above the toolbar and flips below without room: verified in the source and in Chromium captures of both stories.
- Apply and Cancel use the shared check and close icons, Remove is fixed artwork, the icon key list is unchanged: verified.
- Field starts empty or from the link or http text; popup ARIA only when the popover exists; popover rendered beside the toolbar: verified.
- The new record is approved by an engineering owner at this head; the author is a design owner: verified.
- Status-message, catalog and no-reflow rules cited: verified against the current records.
- Selection saved and restored, with focus to the editable root before the editor redraws its selection: verified.
- Anchor wrapper that a press does not scale; Popover's own focus entry with no Effect, relying on the merged focus-order fix: verified (the fix is in the base; the 11-failure figure without it was not rerun).
- A caret outside a link inserts the URL as link text, as on main: verified.
- Red arm: the 12 link tests fail against the base toolbar, and the new browser test fails on the base's modal dialog: verified (rerun; the base dialog is marked modal).
- 12 link tests pass; 47 test files and 780 tests pass: verified by a rerun and in CI on this head.
- Richtext typecheck, lint with 0 errors and the same 32 warnings as the base, prettier, changeset and repository checks: verified.
- Accessibility audit of the 30 editor stories, both link stories included, with 0 violations and the gate passing: verified in CI on this head.
- Playwright selects 107 Chromium tests in 10 files: verified.
- CI's browser legs run all 107 and they pass: false (102 ran, all passing).
- Carry update: main merged with the two conflicts resolved, and the tooltip helper reads the layer when a tooltip repeats the button's name: verified.
- Writing rubric results for the new record: present.
- Files: both changesets, the three story files, the new record, the English catalog, both doc files, both unit test files and both browser specs: clear; the toolbar source: optional notes only.
|
/approve-spec 266e6a5 |
|
Decision: D-20261113-031 |
There was a problem hiding this comment.
Changes requested: the link popover and its new component record are ready, and only the Testing section of the description needs correcting.
- The Testing section says CI's browser legs run all 107 richtext Chromium tests and they pass, but CI did not run on this head (it is a draft), and its pull-request routing never selects
DecoratorPortal.a11y.browser.spec.tsorRichTextCodeLanguages.a11y.chromium.spec.ts, so please say where the 107 tests ran and that CI's pull-request legs run only the files its routing selects. - Miss: the unit-test line (47 files, 780 tests) and the accessibility-audit line (30 stories) also credit "CI on this head" with runs that did not happen on this head, so please name the run behind each result or report them as local runs.
The approved component:RichTextEditorToolbar record settles the direction, and the 12 new link tests, the 780 richtext unit tests and the 107 richtext Chromium tests all pass on this head. The optional notes in the open review threads still apply: a second Link press or a press outside closes the popover without restoring the selection, and a few comments restate the code.
Claims and files checked
- Verified: the Link button and Cmd/Ctrl+K open a non-modal popover anchored to the button, above the toolbar, flipping below it when there is no room.
- Verified: the popover holds one URL field that starts empty with an
example.complaceholder; Enter applies without adding a new line; Apply, Remove (in a link) and Cancel are icon buttons with tooltips. - Verified: Escape and Cancel return focus and the selection to the editor; a refused URL shows its error under the field and keeps focus there.
- Verified: no prop changes;
promptForUrl,hasNewTabLinksand the URL rules are unchanged; withpromptForUrlthe Link button opens and announces no popup. - Verified: Apply and Cancel use the shared
checkandcloseicons, Remove's glyph is fixed, and no icon key is added. - Verified: one new catalog message; the other link messages change only their descriptions; the docs, JSDoc, stories and comments describe the popover.
- Verified: the 12 new link tests pass here and all 12 fail with the base toolbar; the new browser test passes with no axe violations, and the base dialog is modal.
- Verified: the richtext unit suite (47 files, 780 tests), both typechecks, lint (0 errors, the same 32 warnings as the base), formatting, and the changeset, catalog and knowledge checks pass on this head.
- Verified: Playwright lists 107 Chromium tests in 10 files under the richtext tests folder, and all 107 pass on this head.
- False: CI ran the unit suite, the accessibility audit and the browser legs on this head.
- False: CI's browser legs run all 107 richtext Chromium tests.
- Not rechecked: the audit's story count, and three repository checks that need a git checkout.
- Files: both changesets, the three story files, the new component record, the core catalog, both doc files, both unit test files, the toolbar source and both browser spec files; the findings above and the open threads cover them, and the rest are clear.
There was a problem hiding this comment.
Approved: the link popover matches the new component:RichTextEditorToolbar record, which an engineering owner approved at this head, and the description's testing claims now check out against CI on this head.
- Optional: the title's scope names
RichTextEditor, but the change lives inRichTextEditorToolbar; naming that component in the scope would match where the new handlers are.
The optional notes in the open review threads still apply: a second Link press or a press outside closes the popover without restoring the selection, and a few comments restate the code.
Claims and files checked
- Verified: the Link button and Cmd/Ctrl+K open a non-modal popover anchored to the button, above the toolbar, flipping below it when there is no room.
- Verified: the popover holds one URL field that starts empty with an
example.complaceholder; Enter applies without adding a new line; Apply, Remove (in a link) and Cancel are icon buttons with tooltips. - Verified: Escape and Cancel return focus and the selection to the editor; a refused URL shows its error under the field and keeps focus there.
- Verified: no prop changes;
promptForUrl,hasNewTabLinksand the URL rules are unchanged; withpromptForUrlthe Link button opens and announces no popup. - Verified: Apply and Cancel use the shared
checkandcloseicons, Remove's glyph is fixed, and no icon key is added. - Verified: one new catalog message; the other link messages change only their descriptions; the docs, JSDoc, stories and comments describe the popover.
- Verified: the 12 new link tests pass here and all 12 fail with the base toolbar; the new browser test passes with no axe violations, and the base dialog is modal.
- Verified: the richtext unit suite (47 files, 780 tests) passes on this head, locally and in CI's unit run.
- Verified: CI's accessibility audit on this head covers the 30 stories of the rich text editor route, both link stories included, with no violations, and its gate passed.
- Verified: the richtext and core typechecks, lint (0 errors, the same 32 warnings as the base), formatting, and the repository checks pass on this head.
- Verified: Playwright lists 107 Chromium tests in 10 richtext files; CI's routing runs 102 of them in 8 files, and those legs passed at the previous head, whose patch is identical.
- Verified: the branch went to CI before this review, so the one open review item, a description line, is resolved.
- Not rechecked: the historical note that removing the focus Effect failed 11 tests before the Popover focus fix landed.
- Files: both changesets, the three story files, the new component record, the core catalog, both doc files, both unit test files, the toolbar source and both browser spec files; the notes above and the open threads cover them, and the rest are clear.
There was a problem hiding this comment.
Changes requested for two lines of the description; the code needs no change. The link popover matches the new component:RichTextEditorToolbar record, which an engineering owner approved at this head, and CI passed on this head.
- The Testing section's
a11y:auditand Playwright bullets call the commit they cite "the previous head with the same patch", but that commit is two pushes back and its patch lacks this head'sRichTextEditorToolbar.doc.mjschange, so cite this head's CI run (the same 102 richtext browser tests in 8 files and the 30-story audit, all passing) or call it an earlier head whose patch differs only in that file. - Optional: the title's scope names
RichTextEditor, but the change lives inRichTextEditorToolbar; naming that component would match where the new handlers are.
The optional notes in the open review threads still apply: a second Link press or a press outside closes the popover without restoring the selection, and a few comments restate the code.
Claims and files checked
- Verified: the Link button and Cmd/Ctrl+K open a non-modal popover anchored to the button, above the toolbar, flipping below it when there is no room.
- Verified: the popover holds one URL field that starts empty with an
example.complaceholder; Enter applies without adding a new line; Apply, Remove (in a link) and Cancel are icon buttons with tooltips. - Verified: Escape and Cancel return focus and the selection to the editor; a refused URL shows its error under the field and keeps focus there.
- Verified: no prop changes;
promptForUrl,hasNewTabLinksand the URL rules are unchanged; withpromptForUrlthe Link button opens and announces no popup. - Verified: Apply and Cancel use the shared
checkandcloseicons, Remove's glyph is fixed, and no icon key is added. - Verified: one new catalog message; the other link messages change only their descriptions; the docs, JSDoc, stories and comments describe the popover.
- Verified: the 12 new link tests pass on this head and all 12 fail with the base toolbar.
- Verified: the richtext unit suite (47 files, 780 tests) passes on this head, locally and in CI's unit run.
- Verified: the richtext typecheck, lint (0 errors, the same 32 warnings as the base), formatting, the changeset check and the repository checks pass on this head.
- Verified: Playwright lists 107 Chromium tests in 10 richtext files, and CI's browser legs ran 102 of them in 8 files and passed, both on this head and on the commit the description names.
- Verified: CI's accessibility audit on this head covers the 30 rich text editor stories, both link stories included, with no violations.
- False: the commit the audit and browser bullets name is not the previous head, and its patch differs from this head's in
RichTextEditorToolbar.doc.mjs. - Verified: the merge of main, the carried conflict resolutions and the writing-rubric results match the branch.
- Not rechecked: the historical note that removing the focus Effect failed 11 tests before the Popover focus fix landed.
- Files: both changesets, the three story files, the new component record, the core catalog, both doc files, both unit test files, the toolbar source and both browser spec files; the notes above and the open threads cover them, and the rest are clear.
There was a problem hiding this comment.
Approved. The toolbar's link popover matches the new component:RichTextEditorToolbar record, which an engineering owner approved at this head; every changeset and description claim checks out, and CI passed on this head.
Optional, non-blocking (the open review threads have the details):
- A second press on the open Link button closes the popover without restoring the selection; the record's summary row says the selection returns whenever it closes, so either restore it on that route or narrow the row and the code comment.
- The record does not mention the icon buttons' tooltips or the field's
autoComplete="url", and a few comments restate the code.
Claims and files checked
- Verified: the Link button and Cmd/Ctrl+K open a non-modal popover anchored to the button, above the toolbar, flipping below it when there is no room.
- Verified: the popover holds one URL field that starts empty with an
example.complaceholder; Enter applies without adding a new line; Apply, Remove (in a link) and Cancel are icon buttons with tooltips. - Verified: Escape and Cancel return focus and the selection to the editor; a refused URL shows its error under the field and keeps focus there.
- Verified: no prop changes;
promptForUrl,hasNewTabLinksand the URL rules are unchanged; withpromptForUrlthe Link button opens and announces no popup. - Verified: Apply and Cancel use the shared
checkandcloseicons, Remove's glyph is fixed, and no icon key is added. - Verified: one new catalog message; the other link messages change only their descriptions; the docs, JSDoc, stories and comments describe the popover.
- Verified: the 12 new link tests pass on this head and all 12 fail against the base toolbar; the base link dialog is modal, so the new browser assertion fails there.
- Verified: the richtext unit suite (47 files, 780 tests) passes on this head, locally and in CI's unit run.
- Verified: the richtext typecheck, lint (0 errors, the same 32 warnings as the base), formatting, the changeset check and the repository checks pass on this head.
- Verified: Playwright lists 107 Chromium tests in 10 richtext files, and CI's browser legs on this head ran 102 of them in 8 files and passed; the two unselected files hold the other 5.
- Verified: CI's accessibility audit on this head covers the 30 rich text editor stories, both link stories included, with no violations.
- Verified: the template choice, the authority and record statements, the cited accessibility, internationalization and layout rules, the anchor wrapper, the caret-insertion behavior and the merge of main with its conflict resolutions.
- Verified: the evidence screenshots are on the named tag and the placement stills on the named branch; the placement statement is consistent with this review's own browser probes.
- Not rechecked: the historical note that removing the focus Effect failed 11 tests before the Popover focus fix landed; the merge-order note is process context.
- Files: both changesets, the three story files, the new component record, the core catalog, both doc files, both unit test files, the toolbar source and both browser spec files; the notes above cover them, and the rest are clear.
…rs (#11189) * feat(richtext): replace the toolbar link dialog with an anchored popover 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]> * fix(richtext): the link popover uses shared icons, Popover focus and 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. * fix(richtext): the link field keeps its own focus, and a missing scrollIntoView does not stop the popover * Merge main into richtext-link-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]> * docs(richtext): the link popover changeset names what ships; FR6 names 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]> * test(richtext): link tooltips are read from the layer when they repeat 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]> * refactor(richtext): share the toolbar's link popover and format helpers 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]> * refactor(richtext): name the system useToolbarLink's Effect syncs with Co-authored-by: Ernest Tien <[email protected]> * fix(richtext): the link popover anchors to a wrapper a press never scales 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]> * Merge richtext-link-popover (#8717) into richtext-link-extraction 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]> * Merge main into richtext-link-popover Brings in #11177 (Popover focus entry in document order). Co-authored-by: ernestt <[email protected]> * fix(richtext): the link popover's own focus entry focuses the URL field 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]> * Merge richtext-link-popover (#8717) into richtext-link-extraction 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]> * Merge main into richtext-link-extraction * docs(RichTextEditorToolbar): the record names the link popover's files; comments tighten
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.
Primary intent
Change how
RichTextEditorToolbar's existing link capability is presented and operated: its Link button, and Cmd/Ctrl+K in the editor, open a non-modal AstryxPopoveranchored to the button instead of a modalDialog.Template:
other.md.docs/contributing/pull-requests.mdroutes an intentional appearance change tovisual-update.md, whose scope excludes interaction-model changes, and this PR changes the interaction model (modal to non-modal, Enter applies, Escape and Cancel return to the editor). It adds no capability (new-feature.md) and restores no broken behavior (bug-fix.md), so the table's "Anything else" row applies.User or maintainer impact
RichTextEditorwith the toolbar. Adding or editing a link no longer puts a modal and backdrop over the text being linked. The form opens above the toolbar, so it does not cover the first lines of text; it flips below only when there is no room above. Escape or Cancel returns focus to the editor with the selection intact, and Enter applies the link without leaving a stray new line in the text.promptForUrlstill replaces the built-in UI, andhasNewTabLinksand the URL rules (sanitizeUrl) are unchanged. Apply and Cancel use the sharedcheckandcloseicons, so a theme that restyles those icons restyles them here too. Remove's glyph is fixed artwork.RICHTEXT_ICON_KEYSis unchanged.Problem and solution fit
Dialog(purpose="form") that holds a single URL field.Deltas, each mapped to that problem:
Popover(isModal={false}, sibling mode on the Link button,placement="above"(flipping below only without room),alignment="start") replaces theDialog. It holds:TextInput: plain text,inputMode="url",autoComplete="url", spellcheck off, and a placeholder.IconButtonat the toolbar's size, with a tooltip.@astryx.richTextEditor.link.urlPlaceholder. The existing link messages are reused, and their descriptions are updated for the popover. This comes with a@astryxdesign/corechangeset.RichTextEditor.doc.mjs, the unit tests, and a browser spec are updated, plus comments in the stories and specs that described "the link dialog".https://. It still starts from the link's URL, or from selected text that begins withhttp.aria-haspopup/aria-expandedonly when it opens the popover. WithpromptForUrlit opens nothing, so it announces neither.Authority
.github/DESIGNOWNERSand is this PR's author.component:RichTextEditorToolbar(docs/specs/components/RichTextEditorToolbar/RichTextEditorToolbar.spec.md), which records the link popover: one URL field that starts empty with theexample.complaceholder, Enter applies, Escape and Cancel return focus and the selection to the editor, and the popover opens above the toolbar. An engineering owner approved the record; the direction (popover above the toolbar) is the design owner's pick.component:FieldStatusAR1/AR2: the error is announced through the persistent assertive live region, and the message box is not a live region of its own. That is why the error carries norole="alert". The field hasaria-invalidand isaria-describedbythe message.architecture:internationalizationINV1a: every string goes through the catalog.spec:AST-061FR9/DEC-2: the popover is in the top layer and never reflows the document.Change and evidence
packages/richtext/src/RichTextEditorToolbar.tsx: aToolbarLinkFormand thePopoverreplace theDialog,Button, andLayoutcomposition. The selection is still saved and restored the way the dialog did it. Closing to the editor focuses the editable root and then has Lexical draw its saved selection, so the selection survives the field having held the page's selection.inputMode="url"andhasSpellCheck={false}toTextInputas props.hasAutoFocuson. Without fix(Popover): focus entry takes the first content control in document order #11177, removing the Effect failed 11 link tests in jsdom; with it, all pass.architecture:layer-runtimeINV22).mainuses for the link dialog.RichTextEditorToolbarLink.test.tsx(12 tests) was run at 45eef61 withRichTextEditorToolbar.tsxswapped formain's: 12 of 12 failed. That includes the Cmd/Ctrl+K case, which asserts that opening scrolls the Link button into view, a callmain's toolbar never makes. The new browser test fails against a Storybook built from the base: the dialog hasaria-modal="true".Evidence
Real-browser screenshots: Chrome, the Storybook "RichText/RichTextEditor / With Links" story, 760×420 at 2×, theme Neutral.
Placement (real Chrome at 1280 px and a real iPhone 14 at 390 pt, at 45eef61). The popover opens above the toolbar when there's room, start-aligned with the Link button with a 4 px gap, and flips below only when there's no room above. The
WithLinksstory now has room above the editor, andWithLinksNoRoomAboveputs the toolbar at the top of the page.WithLinks)WithLinks, toolbar scrolled to Link)WithLinksNoRoomAbove)Scope
Testing
pnpm exec vitest run packages/richtext/src/RichTextEditorToolbarLink.test.tsx: 12 passed.pnpm exec vitest run packages/richtext/src: 47 test files and 780 tests, all passing, locally at this head (266e6a5); CI's unit legs also pass at this head (run 43380029620).pnpm -F @astryxdesign/richtext typecheck: passed.pnpm -F @astryxdesign/core typecheck: passed.pnpm -F @astryxdesign/richtext lint: 0 errors. The 32 warnings are the same set as on the base.pnpm exec prettier --checkon the changed files: passed.pnpm check:changesets: passed.pnpm check:repo(includingcheck:i18n-catalog): passed.pnpm a11y:audit -- --components richtext/RichTextEditor: CI's audit at this head (run 43380029620) covers 30 stories, the two link stories included, with 0 violations; the gate passed.packages/richtext/src/__tests__/selects 107 Chromium tests in 10 files. CI's pull-request browser legs run only the spec files routed to the changed paths: at this head (run 43380029620) they ran 102 of the 107, in 8 files, and all passed. The routing never selectsDecoratorPortal.a11y.browser.spec.ts(4 tests) orRichTextCodeLanguages.a11y.chromium.spec.ts(1), which this change does not touch.Screenshots are kept on the
evidence/pr-8717-review-assetstag, outside this branch. They predate the move above the toolbar. The current placement stills (the Placement table above) are real-device captures at 45eef61: desktop Chrome at 1280 px and an iPhone 14 at 390 pt, from a device farm run against this branch's Storybook preview, hosted on thepr-assets/8717-placementbranch.Carry update
This branch has
mainmerged in (no rebase; the author's commits are kept), with conflicts resolved inRichTextEditorToolbar.tsx(thehasLinkprop doc keeps the popover text and addsmain's caret insertion) andRichTextEditor.test.tsx(imports from both sides). The changeset now names what ships (sharedcheckandcloseicons, no new icon keys, placement above the toolbar).tooltipOfin the link tests reads the tooltip layer's text when the tooltip repeats the button's name, whichmain's Button no longer exposes as a description.Writing rubric results
Run over
component:RichTextEditorToolbar:CI note: this pull request is on the v0.7.16 Lightbox merge-order path, so it goes to CI before CodeBunny re-approves this head; its only open review item is a description line, fixed above.