|
| 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: * box: [DefaultBoxMacro.java|https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-macros/xwiki-rendering-macro-box/src/main/java/org/xwiki/rendering/internal/macro/box/DefaultBoxMacro.java]. * error, info, success and warning: [AbstractMessageMacro.java|https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/internal/macro/message/AbstractMessageMacro.java]. * code: [CodeMacroParameters.java|https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-macros/xwiki-platform-rendering-macro-code/src/main/java/org/xwiki/rendering/macro/code/CodeMacroParameters.java], which extends the box parameters.
The fix is done once, in [BoxMacroParameters.java|https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-macros/xwiki-rendering-macro-box/src/main/java/org/xwiki/rendering/macro/box/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.
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|| |[box|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/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|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/error/]|C13 constraints|{{width}}|"abc" is accepted by the dialog and output as {{style="width:abc"}}.|XWIKI-25287| |[info|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/info/]|C13 constraints|{{width}}|"abc" is accepted by the dialog and output as {{style="width:abc"}}.|XWIKI-25287| |[success|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/success/]|C13 constraints|{{width}}|"abc" is accepted by the dialog and output as {{style="width:abc"}}.|XWIKI-25287| |[warning|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/warning/]|C13 constraints|{{width}}|"abc" is accepted by the dialog and output as {{style="width:abc"}}.|XWIKI-25287| |[code|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/code/]|C13 constraints|{{width}}|"abc" is accepted by the dialog and output as {{style="width:abc"}}.|XWIKI-25287| |[code|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/code/]|E2 errors|{{width}}|{{{{code width="abc"}}x = 1{{/code}}}} renders with style="width:abc", with no message. Partly covered, see below.| | h2. Impact found on macro fluidity These 6 7 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 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.
The E2 errors KO of code is only partly covered here, for the width. 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. |
|