|
| Description: |
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|https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-gallery/src/main/java/org/xwiki/rendering/macro/gallery/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.
h2. 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.
h2. KOs covered ||Macro||Criterion||Parameter||Problem||Depends on|| |[gallery|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/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|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/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| |[gallery|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/gallery/]|E2 errors|{{width}}, {{height}}|width="abc" is written as style="width: abc;", and height="300" as style="height: 300;", which browsers ignore, with no message. Partly covered, see below.| | h2. Impact found on macro fluidity These 2 3 KOs come from the [WYSIWYG usability audit of the macros|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/], under the criterion criteria C13 constraints and E2 errors of its [usability criteria|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Usability%20criteria/]. 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.
The E2 errors KO of gallery is only partly covered here, for the width and the height. The same KO also reports other invalid values, covered by the other issues listed on the page of the macro, among them XCOMMONS-3847 for the conversion of the values and XRENDERING-823 for the wording of the error. |
|