Remove the dropbutton when there is only 1 button

Created on 3 July 2025, 9 days ago

Problem/Motivation

We shouldn't use dropbuttons when there is only 1 option, ie. 1 button.

📌 Task
Status

Active

Version

1.0

Component

User interface

Created by

🇮🇹Italy kopeboy Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @kopeboy
  • 🇮🇹Italy kopeboy Milan

    I also noticed that the current button breaks the styling of the field form, by making the label inline and other elements after the button not aligned (for example the Delete button on multi-value fields, or additional inputs like those defined in entity_reference_quantity fields - if/when supported).

    I didn't test with Bootstrap, just default core theme Claro (with which anything should work).

    Providing a fix shortly (but I won't be able to test it with Bootstrap).

  • Pipeline finished with Success
    9 days ago
    Total: 144s
    #538147
  • Pipeline finished with Success
    9 days ago
    Total: 142s
    #538166
  • 🇮🇹Italy kopeboy Milan

    I also added core CSS classes (button, button--primary) but I couldn't make them show up when the search button is enabled (so I removed them from the $attributesBootstrapTable).
    It's debatable if Bootstrap-related classes should be added by default, but I left them to not break functionality for existing users.

  • Pipeline finished with Success
    9 days ago
    Total: 142s
    #538174
  • 🇮🇹Italy kopeboy Milan

    Should be good for review now. I hope this helps and will be included in the module!

  • Pipeline finished with Success
    9 days ago
    Total: 142s
    #538190
  • 🇫🇷France lazzyvn paris

    It must support Bootstrap 5 admin(there is an option to enable Bootstrap 5 if your theme is not based on Bootstrap 5), I user lib bootstrap 5 table for search,... I would be happy if the Gin theme were also supported.
    Your merge request doesn't pass the phpcs test, so I definitely can't merge your branch

  • Pipeline finished with Success
    8 days ago
    Total: 222s
    #539210
  • 🇮🇹Italy kopeboy Milan

    Gitlab said "ready to merge", with only minor warnings:

    • Line exceeds 80 characters: on 2 comments I added
    • Expected newline after closing brace: on 2 } else

    but I fixed them now.

    I didn't remove any bootstrap class 👍🏻

    I just tested with Gin:

    • without this MR: the dropbutton is misaligned and taller than the input and the Remove button
    • with this MR:
      • the dropbutton is centered vertically (but still taller - apparently this is a Gin issue: dropbuttons are taller than buttons)
      • the single button is aligned and same height of input and Remove button.

    Recap in attached screenshots.

    Updated issue summary to clarify why this use case is important.

  • 🇮🇹Italy kopeboy Milan

    I also noticed that this MR, since it moves the button element from the field's description to the field's suffix, would also fix the fact that with Gin, when the option form description toggle is enabled in its settings, the button is automatically hidden:

    You need to click the toggle to see the button:

Production build 0.71.5 2024