This issue has been created
 
 
XWiki Rendering / cid:jira-generated-image-avatar-f17ad703-e917-4bcd-a44a-69270eb79b61 XRENDERING-826 Open

Declare the CSS length format of the width of the box, message and code macros

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-6f3167c1-7de6-4371-9945-cb1967537117 Charpentier Lucas created this issue on 22/Oct/26 16:06
 
Summary: Declare the CSS length format of the width of the box, message and code macros
Issue Type: cid:jira-generated-image-avatar-f17ad703-e917-4bcd-a44a-69270eb79b61 Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Macro - Box, Macro - Message
Created: 22/Oct/26 16:06
Priority: cid:jira-generated-image-static-major-03ccb3cc-3b41-444f-adee-db887d546254 Major
Reporter: Charpentier Lucas
Description:

The box macro, the message macros and the code macro take their width as free text in the Edit Macro dialog. The parameter only accepts a CSS length, as its description says, "expressed in px or %", but it declares no format, so the dialog accepts any value and the macro writes it as is into the style attribute of the box: a wrong value is silently ignored by the browser and the user never gets a message.

The macros to change, all through the same parameter class:

The fix is done once, in BoxMacroParameters.java, on setWidth:

  • Declare the accepted format, a number with a px or % unit, for example with a @Pattern annotation, so that an invalid value is refused instead of being written in the style attribute.

Depends on

  • XWIKI-25287, without which the Edit Macro dialog does not enforce the declared format and the value is only checked when the macro is rendered.

KOs covered

Macro Criterion Parameter Problem Depends on
box C13 constraints width "abc" is accepted by the dialog and output as style="width:abc", and "300" without a unit as style="width:300". XWIKI-25287
error C13 constraints width "abc" is accepted by the dialog and output as style="width:abc". XWIKI-25287
info C13 constraints width "abc" is accepted by the dialog and output as style="width:abc". XWIKI-25287
success C13 constraints width "abc" is accepted by the dialog and output as style="width:abc". XWIKI-25287
warning C13 constraints width "abc" is accepted by the dialog and output as style="width:abc". XWIKI-25287
code C13 constraints width "abc" is accepted by the dialog and output as style="width:abc". XWIKI-25287

Impact found on macro fluidity

These 6 KOs come from the WYSIWYG usability audit of the macros, under the criterion C13 constraints of its usability criteria. The page of each macro, linked in the table, has the full notes and the steps to reproduce. Fixing them means declaring the format of one parameter of the box macro parameters.