Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25182

Numeric macro parameters accept any text in the Edit Macro dialog

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • None
    • Display, WYSIWYG Editor
    • None
    • Unknown

    Description

      Macro parameters of a numeric type, such as int, long, float or double, are displayed in the Edit Macro dialog as a plain text input. Any value is accepted, including letters, and the dialog submits it. The user only finds out the value is invalid when the macro is rendered with an error.

      There is no HTML displayer for numeric types, so they fall back to html_displayer/default.vm, which outputs an <input type="text">. The dialog's validation only checks that mandatory parameters are not empty.

      Steps to reproduce

      1. Edit a page with the WYSIWYG editor.
      2. Insert the Table of Contents macro.
      3. Type abc in the start parameter and submit.

      Expected

      The field only accepts numbers. An invalid value is flagged next to the field and the dialog does not submit until it is fixed.

      Actual

      The dialog submits, and the macro renders an error.

      Proposal

      • Add HTML displayer edit templates for the numeric types that output an <input type="number">, with a step allowing decimals for the floating point types.
      • Make the Edit Macro dialog run the browser validation of its inputs before submitting, and flag the invalid field the same way an empty mandatory field is flagged.

      Raised in https://forum.xwiki.org/t/brainstorming-usability-criteria-for-auditing-macros-in-the-wysiwyg-editor/18907/16

      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: