This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-f47413ab-9b1f-48d1-9a35-fe17c4a9d197 XWIKI-25569 Open

Put the cursor in the macro content after inserting a macro whose content is edited in place

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-460d5dbc-bd6c-4d98-be30-24e17b38b713 Charpentier Lucas created this issue on 23/Oct/26 15:14
 
Summary: Put the cursor in the macro content after inserting a macro whose content is edited in place
Issue Type: cid:jira-generated-image-avatar-f47413ab-9b1f-48d1-9a35-fe17c4a9d197 Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: CKEditor
Created: 23/Oct/26 15:14
Priority: cid:jira-generated-image-static-major-c60d271c-803c-460c-9dde-552b199ae009 Major
Reporter: Charpentier Lucas
Description:

After a macro is inserted, from Quick Actions or by submitting the Edit Macro dialog, the WYSIWYG editor selects the whole macro widget instead of putting the cursor in its content. The user has to click in the content before typing, and text typed right away goes nowhere, or outside the macro: for an inline macro like footnote, it goes before the macro, so "XYZ" typed after inserting a footnote at the end of "A sentence" gives A sentence XYZ{{footnote}}My note{{/footnote}}.

The fix is done in the macro plugin of the editor, plugin.js:

  • After inserting a macro whose content is edited in place, put the cursor in that content, at its end, whether the macro was inserted from Quick Actions or from the Edit Macro dialog, and whether its content is mandatory or not.
  • When the content cannot be edited in place, put the cursor after the macro rather than leaving the widget selected.

XWIKI-25563 asks for the same cursor placement for the Quick Actions of the macros whose content is mandatory; this issue extends it to every insertion.

Most macros below need their content to be edited in place first, see the Depends on column.

Depends on

KOs covered

Macro Criterion Problem Depends on
figureCaption I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content: text typed right away goes nowhere.  
cache I4 cursor After submitting the dialog the macro widget is selected and the cursor is not in the content: typed text changes nothing. XWIKI-25567
container I4 cursor After insertion from Quick Actions, the macro is a non-editable placeholder with no content area: typed text goes after the macro. XWIKI-25567
context I4 cursor After the insertion, the macro is a placeholder with no content area: the text typed next goes outside the macro. XWIKI-25567
code I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content: typed text goes nowhere. XWIKI-19978
comment I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content. XRENDERING-831
footnote I4 cursor After submitting the dialog, the macro widget is selected, and text typed right away goes before the footnote number, not after it. XRENDERING-830, XWIKI-19954
gallery I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content. XWIKI-23735
mathjax I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content: typed text goes nowhere. MATHJAX-40
tree I4 cursor After the Quick Actions insertion, a static tree has no content area: typed text goes outside the macro, and nodes are added only as a wiki syntax list in the Edit Macro dialog.  

Impact found on macro fluidity

These 10 KOs come from the WYSIWYG usability audit of the macros, under the criterion I4 cursor of its usability criteria, which asks that after insertion the cursor is in the macro content, so the user can keep typing without an extra click. The page of each macro, linked in the table, has the full notes and the steps to reproduce. This issue fixes figureCaption on its own; the other macros also need their content to be edited in place, and the tree also needs its static nodes to become editable in place, which no issue covers yet.