This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-51012fbc-8c68-4d9e-ad27-11793dd119d6 XWIKI-25182 Open

Numeric macro parameters accept any text in the Edit Macro dialog

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-1b2204be-9a9b-4432-a9b7-8ef6074f5350 Charpentier Lucas created this issue on 06/Oct/26 10:29
 
Summary: Numeric macro parameters accept any text in the Edit Macro dialog
Issue Type: cid:jira-generated-image-avatar-51012fbc-8c68-4d9e-ad27-11793dd119d6 Improvement
Assignee: Unassigned
Components: Display, WYSIWYG Editor
Created: 06/Oct/26 10:29
Priority: cid:jira-generated-image-static-major-58506c10-3914-4a23-9130-d4eb81228c8c Major
Reporter: Charpentier Lucas
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