Skip to content

Web client: a CSS class repeated in DESIGN class is dropped from the rendered element (class = 'custom-button ok ok' renders without ok) #1961

Open

Description

@CrushBy

Description

In the web client, when the class attribute of a component in DESIGN lists the same CSS class twice, the rendered element does not get that class at all. The same class listed once is applied as usual. A duplicate is easy to produce from a metacode that concatenates a component name with an extra class, for example 'custom-button ' + 'ok ok', and the only visible effect is that the CSS written for that class does not apply.

Reproducer (platform 7.0-SNAPSHOT master of 2026-11-04, web client):

okAction 'OK' () { MESSAGE 'ok'; }

FORM probeFb 'Probe FB'
    PROPERTIES ok1 = okAction(), ok2 = okAction()
;

DESIGN probeFb {
    PROPERTY(ok1) { class = 'custom-button ok ok'; }
    PROPERTY(ok2) { class = 'custom-button ok'; }
}

Class attribute of the two rendered buttons:

  • ok1: btn ... panel-renderer-value prop-size-value wrap-text-not-empty custom-button flex-center btn-outline-secondary — no ok
  • ok2: btn ... panel-renderer-value prop-size-value wrap-text-not-empty custom-button ok flex-center btn-outline-secondary

Expected: an HTML class list ignores repetitions, so 'custom-button ok ok' should render with both custom-button and ok, and a rule such as button.ok { ... } should match. The same applies to valueClass and captionClass, which go through the same class update.

Fix

Ignore a repeated class name when the class changes of a component are computed (deduplicate the list before it is compared with the previously applied classes), so that a repetition neither cancels the addition nor flips the class on a later update.

Reason

The changes are collected into a map keyed by the class name: the first occurrence of ok is put into the map as "add", the second occurrence finds that pending entry, removes it as if the class were already present and adds nothing back, so the class is never applied on the first render. On a later update with the same string the previously applied list already contains two ok entries, and the same logic then adds the class, so the state flips on every re-application.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions