When using node/add form using Bootstrap5's theme, the input boxes .form-control are using display:block and

  <li></li>
</ol>>width:100%

which makes the prefix/suffix elements of a form to get wrapped in new lines instead of the same line.

A simple proposed fix would be to make use of bootstrap's input-group classes in form-element.html.twig:

  {% if prefix is not empty or suffix is not empty %}
    <div class="input-group">
      {% if prefix is not empty %}
        <span class="input-group-text">{{ prefix }}</span>
      {% endif %}
      {{ children }}
      {% if suffix is not empty %}
        <span class="input-group-text">{{ suffix }}</span>
      {% endif %}
    </div>
  {% else %}
    {{ children }}
  {% endif %}

Difference is in the attached photos. (before and after)

Steps to Reproduce:

  1. Create a Node with fields
  2. Add a field that has a prefix/suffix
  3. Access the node/add form using bootstrap5 theme, not admin. The fields will be broken
CommentFileSizeAuthor
#8 after.png6.76 KBiaacristobal
#8 before.png6.83 KBiaacristobal

Issue fork bootstrap5-3555702

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

iaacristobal created an issue. See original summary.

iaacristobal’s picture

Assigned: Unassigned » iaacristobal
Status: Active » Needs review
iaacristobal’s picture

Issue summary: View changes
jannakha’s picture

Status: Needs review » Needs work

please create MR with attache before patch and after patch screenshots/produced output

iaacristobal’s picture

Issue summary: View changes
StatusFileSize
new6.83 KB
new6.76 KB
iaacristobal’s picture

Status: Needs work » Needs review
jannakha’s picture

Version: 4.0.6 » 4.0.x-dev
Status: Needs review » Reviewed & tested by the community

thank you for your contribution!
fix works!

please release!

vladimiraus’s picture

Assigned: iaacristobal » Unassigned
Status: Reviewed & tested by the community » Fixed

Thank you. Committed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • vladimiraus committed d6af582e on 4.0.x
    feat: #3555702 Form prefix/suffix gets wrapped in new lines, use form-...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.