This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-b00f896a-5a5a-44a0-9bde-0820898dc2ee XWIKI-25582 Open

Refuse the invalid values of the cache, code, container, gallery and menu macros instead of ignoring them

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-4f062d74-d727-4570-bc65-fab8478e1d00 Charpentier Lucas created this issue on 23/Oct/26 17:13
 
Summary: Refuse the invalid values of the cache, code, container, gallery and menu macros instead of ignoring them
Issue Type: cid:jira-generated-image-avatar-b00f896a-5a5a-44a0-9bde-0820898dc2ee Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Menu, Rendering - Cache Macro, Rendering - Code Macro, Rendering - Container Macro, Rendering - Gallery Macro
Created: 23/Oct/26 17:13
Priority: cid:jira-generated-image-static-major-833a2812-9ca3-47e9-ac22-2320c8b4555e Major
Reporter: Charpentier Lucas
Description:

These wrapper macros accept values that they cannot use and render their content as if nothing was wrong, or with a technical message, so the user does not learn that the value has no effect.

The macros to change, with the file where most of the fix is done:

The main problems:

  • cache: maxEntries with "-3", "0" or "2.5" gives the Infinispan error "ISPN000424: Memory eviction is enabled [...]", and timeToLive accepts "0" and negative values. Both need a declared minimum.
  • code: an unknown language renders the code without highlighting, with no message.
  • container: justify="true" has no effect without layoutStyle="columns", since the CSS of the justified class is only loaded by that layout.
  • gallery: a reference to a missing image shows an endless loading spinner in the slide show.
  • menu: an id with a space gives an invalid HTML id, which the toggle of the mobile menu cannot target, and a content that is not a list is shown as is in the menu bar.

The fix is to check these values in each macro and to fail, or warn in the editor, with an error naming the parameter when a value has no effect.

Depends on

  • XCOMMONS-3847, which refuses the boolean and number values that do not convert.
  • XRENDERING-823, which makes the error of an invalid parameter name the parameter and the expected value.

KOs covered

Macro Criterion Problem
cache E2 errors maxEntries with "abc", "-3", "0" or "2.5" gives the Infinispan error "ISPN000424: Memory eviction is enabled, please specify a maximum size or count greater than zero", and timeToLive with "-3" or "0" is accepted silently. Partly covered, see below.
code E2 errors An unknown language, like {{code language="nosuchlanguage"}}<b>x</b>{{/code}}, renders the code without highlighting, with no message. Partly covered, see below.
container E2 errors justify="true" without layoutStyle="columns" has no effect, with no message, since the CSS of the justified class is only loaded by the columns layout. Partly covered, see below.
gallery E2 errors A reference to a missing image, like image:alice.png, shows an endless loading spinner in the slide show. Partly covered, see below.
menu E2 errors id="my menu" outputs an invalid HTML id, which the toggle of the mobile menu targets as "#my menu", and a content that is not a list, like a paragraph or a table, is shown as is in the menu bar, with no message. Partly covered, see below.

Impact found on macro fluidity

These 5 KOs come from the WYSIWYG usability audit of the macros, under the criterion E2 errors of its usability criteria, which asks that an invalid parameter value produces a message that says what is wrong and how to fix it, not a stack trace. The page of each macro, linked in the table, has the full notes and the steps to reproduce.

Each of these KOs is only partly covered here, for the problems specific to the macro. The same KOs also report invalid values that the macro system handles for every macro: XCOMMONS-3847 refuses the booleans and numbers that do not convert, and XRENDERING-823 makes the error name the parameter and the expected value. The other parameters of these macros are covered by XRENDERING-826 and XWIKI-25561 for code, XWIKI-25502 for the container layout and the menu type, and XWIKI-25508 for the gallery size.