| The gallery macro takes its width and height as free text in the Edit Macro dialog. Both only accept a CSS length, but they declare no format and their descriptions, "The gallery width" and "The gallery height", do not say what to type. The dialog accepts any value and the macro writes it as is into the style attribute of the gallery: a wrong value is silently ignored by the browser and the user never gets a message. The fix is done in GalleryMacroParameters.java, on setWidth and setHeight:
- Declare the accepted format, a number with a CSS 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 |
| gallery |
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 |
| gallery |
C13 constraints |
height |
"abc" is accepted by the dialog and output as style="height: abc;", and "300" without a unit as style="height: 300;". |
XWIKI-25287 |
Impact found on macro fluidity These 2 KOs come from the WYSIWYG usability audit of the macros, under the criterion C13 constraints of its usability criteria. The page of the macro, linked in the table, has the full notes and the steps to reproduce. Fixing them means declaring the format of two parameters of the macro. |