Review main Merged

91386[TASK] Only use GenericButton when needed, prefer Input/LinkButton

Garvin Hicking CR +2 V +2 Normal +31 −42 updated 11/11/25, 11:33

Commit message

The change in #107884 had a few spots where a GenericButton
was emitted as `<button href=...>` which is unfitting.

This patch streamlines those usages to convert the GenericButton
into a LinkButton (with the appropriate styling/classes/attributes).

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Garvin Hicking +1
    • Riccardo De Contardi +1
    • core-ci +1 CI

Issues 4

Files 3

Review log 3343

Show 1318 earlier messages
  1. Garvin Hicking uploaded patch set 1 10/31/25, 09:47

  2. Garvin Hicking updated the commit message in patch set 2 10/31/25, 09:54

  3. core-ci voted on patch set 1 V +1 10/31/25, 09:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88238

  4. core-ci voted on patch set 2 V +1 10/31/25, 10:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88239

  5. Oli Bartsch uploaded patch set 3 V +1 10/31/25, 10:38

  6. core-ci voted on patch set 3 V +1 10/31/25, 10:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88243

  7. Josua Vogel commented on patch set 3 10/31/25, 10:52

    FileList.php:1111

    Wouldn´t it be better to allow setting "target" on link button?
  8. Ayke Halder commented on patch set 3 CR -1 10/31/25, 11:12

    IMO only `GenericButton` which uses `setTag('a')`/`setHref` might need a comment like ``` // Note: This is a GenericButton, so that actual attributes (not only data-) can be passed. ``` **For `GenericButton` that does not use `setHref`:** I do not see any alternative but using `GenericButton` here. `LinkButton` should not be used in that case anyway. So no comment needed ;-)
  9. Ayke Halder commented on patch set 3 10/31/25, 11:21

    In geneneral: Every button and link MUST support `aria` attributes. Every button-component that supports rendering `<button>` tags should also support: * `type` attribute with values `button`,`submit` and `reset`. The `LinkButton` should support an option to add `target="_blank"` - no other values for `target` needed. Or is TYPO3 BE a pure web application and thereby there is no need for links to switch pages by using browser url navigation?
  10. Garvin Hicking commented on patch set 3 10/31/25, 11:58

    Reply

    Feel free to create an alternative variant of this patch or push over this one, thanks! I'm not into the specifics of this.
  11. Ayke Halder uploaded patch set 4 CR -1 V +1 10/31/25, 12:08

  12. core-ci voted on patch set 4 V +1 10/31/25, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88248

  13. Ayke Halder commented on patch set 4 CR +1 10/31/25, 12:22

    Reply

    Removed some comments.

    Reply

    This is an extra task.

    FileList.php:1111 Reply

    Doing this in a follow-up task.
  14. Oli Bartsch commented on patch set 4 10/31/25, 12:24

    Reply

  15. Ayke Halder uploaded patch set 5 CR +1 V +1 10/31/25, 20:38

  16. core-ci voted on patch set 5 V +1 10/31/25, 20:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88287

  17. Ayke Halder uploaded patch set 6 V +1 10/31/25, 20:46

  18. Ayke Halder uploaded patch set 7 10/31/25, 20:49

  1. core-ci voted on patch set 6 V +1 10/31/25, 20:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88288

  2. core-ci voted on patch set 7 V +1 10/31/25, 20:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88289

  3. Garvin Hicking commented on patch set 7 CR +1 V +1 11/02/25, 16:36

    thanks looking good to me - voting on the improvements by oli and ayke
  4. Georg Ringer voted on patch set 7 CR +1 V +1 11/02/25, 18:54

  5. Josua Vogel voted on patch set 7 CR +1 V +1 11/02/25, 20:19

  6. Oli Bartsch commented on patch set 7 V -1 11/02/25, 22:08

    Please wait, I would like to check tomorrow, whether all possible replacements (based on https://forge.typo3.org/issues/107952) are included.
  7. Ayke Halder commented on patch set 7 CR -1 11/03/25, 13:59

    TODO: Refactor `GenericButton`/`LinkButton` to `DropDownItem` conversion in `TYPO3\CMS\Backend\RecordList\DatabaseRecordList::makeControl()`

    Reply

    About changes introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/91288 Please also check all the `createGenericButton()`/`createLinkButton()` buttons collected by `$secondary->add('…', …);` in `TYPO3\CMS\Backend\RecordList\DatabaseRecordList::makeControl()`. All these `secondary` buttons get converted via `createDropDownItem()` at the end of `makeControl()` - see `foreach ($secondary->getItems() as $action)` … IMO these `secondary` buttons should be created via `createDropDownItem()` in the first place - then the conversion can be dropped.
  8. Ayke Halder uploaded patch set 8 CR +1 V +1 11/03/25, 14:27

  9. Ayke Halder commented on patch set 8 CR -1 11/03/25, 14:32

    Reply

    Or is it by purpose to have all entries as `Buttons` in the first place, so that the buttons can be rearranged in `ModifyRecordListRecordActionsEvent` between `primary` and `secondary`? Last change removed setting `class` attribute for `DropDownItem`. `AbstractDropDownItem::getAttributesString()` does completely override the `class` attribute anyway.
  10. core-ci voted on patch set 8 V +1 11/03/25, 14:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88385

  11. Garvin Hicking commented on patch set 8 11/05/25, 18:59

    There's another problem raised in https://forge.typo3.org/issues/107966 The "DropdownItem" has a fixed CSS class of "dropdown-item dropdown-item-spaced" which can not be set from the outside. But clipboard actions would need extra CSS class "t3js-modal-trigger" to properly trigger the JS event for it.
  12. Ayke Halder commented on patch set 8 11/06/25, 10:24

    Reply

    These `t3js-…` prefixed classes are specific to trigger a TYPO3 javascript action. A quick search in all PHP files (excluding Tests) shows only two cases of `t3js–…`: * `t3js-icon` in `TYPO3\CMS\Core\Imaging\Icon` * `t3js-splitbutton` in `TYPO3\CMS\Backend\Template\Components\Buttons\SplitButton` But there are lots of uses of `t3js–…` in Fluid template files. IMO as `t3js-…` is TYPO3 specific: We might extend `GenericButton`, `AbstractButton` and `AbstractDropDownItem` with `setT3JsAction()` - and then merge this into the class attribute on rendering attribute string? Maybe also add it to `DropDownItemInterface` and `ButtonInterface`.
  13. Garvin Hicking commented on patch set 8 11/06/25, 13:43

    Reply

    I think we should create a distinct ability to attach/inject extra classes into the SplitButton, and also to replace classlists. If that's with manipulating the "class" attribute or by having distinct methods like for T3JS or "ensureThisIsAJsButton(true)" or whatever, I don't know. Probably @bo@cedev.de has a masterplan for this?!
  14. Andreas Nedbal uploaded patch set 9 CR -1 V +1 11/10/25, 13:55

  15. core-ci voted on patch set 9 V +1 11/10/25, 14:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88853

  16. Andreas Nedbal commented on patch set 9 11/10/25, 14:42

    Reply

    I solved this problem! I made an interesting observation. GenericButtons in `makeClip` were using `setAttributes` wrong as well, because the render calls in GenericButton use the combination of fixed classes and `$this->getClasses()` to assemble the class list. Thus, setting `attributes['class']` leads nowhere. Using the extra instance member `classes` now enables "storing" the extra classes (`t3js-modal-trigger` in our case), and setting button classes isn't needed because GenericButton sets them on render anyway. (this is only important if a button is rendered as a primary action) So, when we turn the GenericButton into a DropdownItem, we can now specifically set the class attribute of it to the value of `$action->getClasses()`. This is the main change of my patchset, allowing setting other classes to `DropdownItem`s with the dropdown item classes being prepended to whatever gets passed into `attributes['class']`. _(I'm open to also establish `get/setClasses` here, to be fair, I just didn't want to introduce new methods for now)_
  17. Garvin Hicking updated the commit message in patch set 10 V +1 11/10/25, 15:09

  18. Garvin Hicking commented on patch set 10 CR +1 V +1 11/10/25, 15:10

    Reply

    (see note above)

    Reply

    Yes, I believe this is the reasoning. We want extensions to be able to use the event to rearrange "actions". The thing that could (should?) be refactored is that we have the unfortunate situation that we "abuse" a GenericButton as some kind of data object to transfer a generic action that is transposed later on. Ideally it should be a REAL data object. That would require a lot of refactoring though which is outside the scope of this patch. I belive with Andreas Nedbals approach we can currently work with this and improve the situation to be clear. Hope it's fine to resolve this.

    Reply

    Thanks so much for investigating this and talking it over with me, Andreas. I think this approach is unobtrusive and doesn't affect too much of the other code (like changing that JS identifiers are data-based instead of class-based). Also many, many thanks to you, @mail@ayke-halder.de, for doing refactoring and bringing up important questions. I hope we can cross the finish line :-)
    (voting on collective changes)
  19. core-ci voted on patch set 10 V +1 11/10/25, 15:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88866

  20. Riccardo De Contardi commented on patch set 10 V +1 11/10/25, 15:53

    The buttons cited on https://forge.typo3.org/issues/107966 now work
  21. Oli Bartsch voted on patch set 10 CR +1 V +1 11/10/25, 16:19

  22. Benni Mack voted on patch set 10 CR +2 V +2 11/10/25, 16:21

  23. Benni Mack merged patch set 11 11/10/25, 16:21

  24. Ayke Halder commented on patch set 10 11/10/25, 16:22

    DatabaseRecordList.php:2023

    This now needs `'class' => $action->getClasses(),` again.
  25. Ayke Halder commented on patch set 11 11/11/25, 11:33

    DatabaseRecordList.php:2023 Reply