#107336Primary button of SplitButton does not support href or data-* attributes
Description
Hello,
since the removal of setOnClick in the ButtonBar component (due to CSP, see #91814), we need alternative ways to link from backend modules to e.g. the TCE form module.
I tried the following options:
InputButton with data-attributes → does not render any data-* attributes on the primary button.
LinkButton with href → does not render the href for the primary button.
The relevant code is hardcoded here:
https://github.com/TYPO3/typo3/blob/2db50cbebdfbaf2cfd4c130e3ebcfad790ab8f72/typo3/sysext/backend/Classes/Template/Components/Buttons/SplitButton.php#L26
Currently, the primary button is restricted to form submission (
SplitButton is effectively limited to submitting a form on the same page.
It cannot be used for the common use case of opening TCE forms, popups, or other backend modules as the primary action.
Developers are forced into workarounds (manual markup, custom patches, multiple single buttons).
Suggested Solution:
Extend SplitButton so that the primary button also supports href and data-* attributes (independent of whether it is an InputButton or LinkButton).
This would align the primary button with the functionality already available for secondary buttons and make the component more useful in practice.
At the very least, if this restriction is intentional, it should be documented in the PHPDoc and/or manuals that SplitButton primary actions are only for form submissions.
Thanks
Stefan