I'm using Bootstrap 8.x-3.x-dev (2016-Feb-20) and I noticed that both the username and password input fields at /user/login are automatically stretched to fit the entire screen. This ignores the '#size' property in the FAPI, which I think should be respected.

In Bootstrap 3.0-beta2 for D8, it's a little different: the username is stretched (because it has a maxlength of 255), while the password shows the number specified for '#size' in hook_form_alter()).

Comments

ptmkenny created an issue. See original summary.

ptmkenny’s picture

Issue summary: View changes
ptmkenny’s picture

Issue summary: View changes
markhalliwell’s picture

Category: Bug report » Support request
Status: Active » Closed (works as designed)

The reason they're "stretched" full width is because they both have a form-control class. This is part of Bootstrap's design and I'm not going to fight that out-of-the-box. There are several ways to alter this form as you see fit, in a sub-theme.

AdamPS’s picture

@markcarver Thanks for the explanation.

I am interested to know how to fix it in the sub-theme as Mark said. I'm looking for a solution that covers every form input, not just user login as a special case. I posted a question on "Drupal Answers", which is more visible than this closed issue. Or I would be very happy to get an answer here and I can transfer it across.

AdamPS’s picture

Title: Form input size is not respected » Provide option to respect form input size
Category: Support request » Feature request
Status: Closed (works as designed) » Active

@markcarver I appreciate you may prefer to close this again, but I have an update that I'd like to bring to your attention.

Problem

Many, many inputs ending being stretched by this code in bootstrap and it can be really unhelpful for designers working on layout.

Answer

I have figured out some CSS that seems to work quite well to disable the stretching:

.form-control,
.input-group .form-control,
.input-group-btn {
  width: auto;
}

Proposal

Create a new theme option, perhaps under "components"->"forms". "Use bootstrap input sizing".
True = current behavior = stretched, control with can .col-lg-*
False = add above css = obeys Drupal input sizes

Thanks

markhalliwell’s picture

Title: Provide option to respect form input size » Form input size is not respected
Category: Feature request » Support request
Status: Active » Closed (works as designed)

No. This is the default behavior of Bootstrap. Any customization like this should be handled on a sub-theme basis.