Review main Merged Breaking

79492[!!!][TASK] Connect label with element in FormEngine

Christian Kuhn CR +2 V +2 Hard +321 −173 updated 06/27/23, 14:48

Commit message

A single FormEngine element (created by "element"
classes that typically extend AbstractFormElement)
takes care of the "inner" HTML of an element.

The surrounding "outer" HTML like embedding elements
in palettes is created by "container" classes. Also,
<label> tags for single elements are created by
container classes, namely PaletteAndSingleContainer
and FlexFormElementContainer.

The situation having <label> done by a container and
the inner HTML done by elements has drawbacks:
First, "label" tags should have a "for" attribute,
to connect it with input fields having "id" attribute.
This is one of the accessibility "must haves".
Separating label and fields in different classes
does not allow doing this. Secondly, not all elements
have such input or select tags at all. In those cases,
the label is not a label, but should be a legend
embedded in a fieldset.

The patch moves the existing label tag generation from
container classes to element classes: Only elements
know if, how and where label and legend tags should
be placed. The patch adds two helper methods to
AbstractFormElement to simplify this, and connects
the label tag with the input field in all elements
or adds a fieldset with a legend.

The v12 version of the patch needs to jump through
some additional loops: When elements take care of
label or legend, they signal this by setting the
flag labelHasBeenHandled in the result array. The
container then skips label creation to not have
them twice. This is a b/w compat layer for not yet
adapted custom elements in v12. The v13 version of
the patch does not come with this fallback layer
and documents needed custom element changes in a
ReST file.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 48

Show 28 more files