Uploaded image for project: 'XWiki Rendering'
  1. XWiki Rendering
  2. XRENDERING-826

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

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 17.10.14, 18.8.0
    • None
    • Unknown

    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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Lucas C Charpentier Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: