question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BFormTextarea should allow 1 row

See original GitHub issue

In this commit, the default value for the rows prop of the BFormTextarea component was changed to ‘2’, which is good. However it now ignores a prop value of ‘1’, which was previously possible - the computedMinRows computed property forces a value of at least 2.

This makes it impossible to have a BFormTextarea display one row if the contents has 0 or 1 rows, and grow from there as the user enters text. Could the minimum rows please be decreased to 1?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
cvncommented, Oct 23, 2020

I came up with a CSS solution.

<b-form-textarea
  v-model="messageText"
  :class="{short: messageText.length < 30 && !messageText.includes('\n')}"
  max-rows="4"
/>
.short {
  max-height: 38px;
}

Or, when I want a textarea to show up as one line by default, but grow when focused, I use a static css class:

.short:not(:focus) {
  max-height: 38px;
}
4reactions
tmorehousecommented, Feb 20, 2019

Unfortunately 1 is not a valid value for rows across browsers. Certain versions of firefox will crap out when set to 1, and other browsers will force it to 2 (el.rows === 2) even though you have set it to 1.

The minimum value of 2 is on purpose to work cross browser. Allowing other values may crap out on some browsers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form Textarea | Components - BootstrapVue
Create multi-line text inputs with support for auto height sizing, minimum and maximum number of rows, and contextual validation states.
Read more >
Form Textarea | BootstrapVue 3 - cdmoro
Form Textarea. Create multi-line text inputs with support for auto height sizing, minimum and maximum number of rows, and contextual states.
Read more >
VueJs Form textarea and text formatting issue using ...
I'm using BootstrapVue to build a row with two columns. The first column has a text and the second column has a b-form-textarea...
Read more >
The Textarea element - HTML: HyperText Markup Language
This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form-associated element in...
Read more >
HTML textarea rows Attribute - W3Schools
The rows attribute specifies the visible height of a text area, in lines. Note: The size of a textarea can also be specified...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found