Review main Merged

87775[BUGFIX] Fix missing FormEngine file upload controls for maxitems=X

Garvin Hicking CR +2 V +2 Easy +4 −2 updated 01/16/25, 10:28

Commit message

Unlike the IRRE inline container, the file upload container uses
a webcomponent, thus the CSS selector with ':scope >' is not
applicable.

Because the selector did not match, the file controls could not
be re-enabled once it was hidden due to a max/minitems configuration.
Also, the form could not be saved because a file would then be
missing.

IRRE childs with max/minitems were not affected.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 78

  1. Garvin Hicking uploaded patch set 1 01/16/25, 08:01

  2. core-ci voted on patch set 1 V +1 01/16/25, 08:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72547

  3. Andreas Kienast voted on patch set 1 CR +1 V +1 01/16/25, 08:09

  4. Oli Bartsch voted on patch set 1 CR +2 V +2 01/16/25, 08:22

  5. Oli Bartsch merged patch set 2 01/16/25, 08:22

  6. Benjamin Franzke commented on patch set 2 01/16/25, 09:20

    Please note that this argumentation is wrong, the `:scope >` selector would also work for a webcomponent, but the selector did not work because the `.t3js-file-controls` container is not directly nested within the files control inner container (first `.form-group`), but wrapped by another intermediate (and duplicate `.form-group`): ``` <typo3-formengine-container-files identifier="data-1766-tt_content-714-image"> <div class="form-group" id="data-1766-tt_content-714-image" …> <!-- This .form-group is the "issue" --> <div class="form-group t3js-formengine-validation-marker"> <div class="form-control-wrap t3js-file-controls"> … </div> </div> </div> </typo3-formengine-container-files> ``` Therefore the expectation for a directly nested element was not fulfilled. The fix is "ok" as-is (as it reverts to the previous state, prior to #105808), but ideally we'd use scope to increase robustness in case someone ever nested file references in file references (very theoretical, I know, but anyway…)
  7. Garvin Hicking commented on patch set 2 01/16/25, 10:11

    Reply

    Thank you for the explanation, this was helpful for me to understand better. So using `:scope .t3js-file-controls` (mind the missing `>`) would be better? Should I create a follow-up, or revert this?
  8. Benjamin Franzke commented on patch set 2 01/16/25, 10:28

    Reply

    `:scope > * > .t3js-file-controls` would have been better (to assure that only the directly nested grandchild is queried, not another, possibly deeply nested one – in your case case (without `>`) all nested elements would be found). No followup needed, as it is very theoretical