Repository navigation
Description
Extracted from #79604 (comment). Props to @ciampo.
This is tracking issue of follow-up fixes for the new RichTextControl component.
1. Complete the ARIA autocomplete contract. Fixed via #80403.
packages/dataviews/src/components/dataform-controls/richtext/control.tsx:503-526
[major] This new surface exposes the shared autocomplete hook's incomplete list-autocomplete semantics. The textbox ultimately receives
aria-autocomplete="list",aria-owns, andaria-activedescendant, but noaria-controlsor matchingaria-haspopup; it also adds/removesaria-autocompletebased on whether results are currently visible instead of exposing expanded/collapsed state.WAI-ARIA 1.2's
aria-autocompletedefinition requires list autocomplete to reference the suggestions witharia-controlsand expose a matching popup type, and advises using expanded state rather than dynamically togglingaria-autocomplete. Since the behavior comes fromuseAutocompleteProps, I would fix the shared@wordpress/componentshook rather than patching only DataViews, then add an integration test here for the textbox/listbox relationship.
2. Keep overlay placement out of field-level focus tracking - Fixed via #80324.
packages/dataviews/src/components/dataform-controls/richtext/control.tsx:550-617
[major] The per-control
SlotFillProviderand body-portalledPopover.Slotmake overlay placement part of this DataViews field solely so focus ownership can be tested through DOM containment. This creates a separate overlay root for every field, bypasses the shared/default Popover container and cuts across the ongoing central overlay-slot consolidation. It also requires the additional container state, ref containment checks, and document-levelfocusoutlistener above.Could we let registered formats keep using the normal
Popover, then placeRichTextControlShellandFormatEditunder one focus boundary?onFocusCapturecan cancel a pending deselection, while a deferredonBlurCapturecan deselect when focus actually leaves. Focus events from portalled Popovers bubble through the React tree, so this recognizes overlays owned by the field without depending on their DOM container; unrelated overlays remain outside the boundary. That would remove the localSlotFillProvider,Popover.Slot, body portal, containment logic, and document listener. The Popover should remain portalled through its default behavior rather than rendered inline, because the notes sidebar has clipping and scrolling ancestors. The existing own-popover, leave-popover, and unrelated-popover tests can exercise the same behavior against the default container.
3. Restore caret position when a format popover returns focus. Fixed via #80396.
packages/dataviews/src/components/dataform-controls/richtext/control.tsx:346-348
Canceling a format popover — most visibly, the inline link UI dismissed via Escape — returns focus to the field via
onFocus(), but the caret lands at the start of the text rather than the previous selection. The block-editorRichText(packages/block-editor/src/components/rich-text/index.js) has an identicalonFocushandler and does not exhibit this.The
onFocushandler is not the cause. On focus-return, the rich-text focus-in handler runsapplyRecord( record.current, { domOnly: true } )(packages/rich-text/src/hook/event-listeners/input-and-selection.js:307-308), and{ domOnly: true }intentionally skips selection restoration (packages/rich-text/src/to-dom.js:228) — so the caret is left wherever the browser dropped it after the popover excursion. In the block editor, the selection lives inblockEditorStoreand is reapplied to the DOM by the store/writing-flow machinery, so the caret survives. The standalone control keeps selection in an isolated local state with nothing re-applying it, so it relies on the browser preserving the DOM selection while the body-portalled popover held focus, which does not survive, and the caret falls back to offset 0.The recommended fix is to make the standalone (non-
editableRoot) branch of the rich-text focusin handler restore the selection like theeditableRootbranch just above it (input-and-selection.js:278-288): whenisSelectedand the DOM selection is no longer inside the element, do a fullapplyRecord( record.current )instead of thedomOnlyvariant. This fixes the dataforms field without regressing the block editor, whose DOM selection is still normally inside the element, and keeps thedomOnlyfast path.
4. Replace the field's SlotFill isolation with a format-host toolbar capability
Extracted from #80324 (review).
packages/dataviews/src/components/dataform-controls/richtext/control.tsx:467-519 (after #80324)
FormatEditmounts every registered format'seditcomponent. Core formats such as bold, italic, link, and code renderRichTextToolbarButton, which registers aFillnamedRichText.ToolbarControls.*; the block editor'sFormatToolbarrenders matchingSlots under the same outer provider. Without a provider of its own, this field's controls can therefore reach a surrounding block toolbar. Those controls close over the standalone field's value, selection,onChange, andonFocus, so rendering them in the block toolbar makes them appear to belong to the block while they mutate the note or DataForm field instead. #80324 retains the localSlotFillProvideras a temporary compatibility boundary for exactly this reason.Ideally, a registered format would not expose shortcuts/input handlers, inline UI such as the link Popover, and toolbar contributions through one
editcomponent. Those concerns would be separate contributions, and each rich-text host would render only the ones it supports. A standalone field could then enable shortcuts and inline UI without participating in a block toolbar at all. That contract cannot be replaced without breaking long-standing public APIs:registerFormatTypeand its combinededitcallback date to October 2018, andRichTextToolbarButtonhas been part of the public format API since November 2018.The backward-compatible path is to replace the generic SlotFill isolation with an explicit format-host capability.
@wordpress/rich-textalready provides the private host contexts used for shortcuts and input events; add a similarly private format-edit context whose toolbar capability defaults totrue. The DataViews host opts out aroundFormatEdit, andRichTextToolbarButtonchecks that capability before registering itsFill. For example, the host-side shape could be:<FormatEditContext.Provider value={ { toolbar: false } }> <FormatEdit ... /> </FormatEditContext.Provider>This should describe host capability — not a block-editor slot destination — and retain the existing
RichText.ToolbarControls.*names and default behavior. Existing formats using the documentedRichTextToolbarButtonpath therefore behave as before; only this private standalone host opts out. A format that bypasses that component and targets the literal SlotFill names would not honor the capability, but those names are undocumented implementation details and should not define the cross-package contract.Once that targeted boundary exists, remove the local
SlotFillProviderfrom this control. Tests should prove that the context defaults to the current toolbar behavior and that the DataViews opt-out prevents surrounding toolbar fills without changing shortcuts or real Popovers. Whether standalone rich-text fields should instead expose their own visible toolbar is a separate product/accessibility decision.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields🦵 Punted to 7.3
Activity
t-hamano commentedon Aug 6, 2026
I believe this is the only remaining problem in this issue, but since it will likely be difficult to resolve in 7.1, I'd like to punt it to 7.2.
Mamaduka commentedon Aug 6, 2026
Yes, we can punt this. Thanks for checking, @t-hamano!
ciampo commentedon Aug 25, 2026
Now that the 7.2 development cycle has started, would it be a good time to work on a fix for the last point? Would it make it on time for the next 7.1 minor, even?
Mamaduka commentedon Aug 25, 2026
I'll try to have a look, but I don't think it's super urgent for a minor release, since nothing is actually broken and it's more of a larger refactoring.
The control has moved to
collab-sidebarin #81430, so there's only one consumer for it.