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.

[Bug]: textarea cols not working as expected

See original GitHub issue

Package

@carbon/react

Browser

No response

Package version

latest

React version

latest

Description

When adjusting the cols in <TextArea> nothing is changing. I would expect the width of the <TextArea> to shrink or grow depending on the number set to cols.

rows works as expected.

when removing the min-width and width: 100% then the <TextArea> adjusts as expected Screen Shot 2022-11-02 at 7 39 08 AM

Suggested Severity

Severity 4 = Unrelated to a user task, has a workaround or does not need a workaround.

Reproduction/example

https://codesandbox.io/s/vigorous-knuth-vsff4p?file=/src/App.js

Steps to reproduce

Go to the example and try changing the number of cols.

Then try adjusting the styles like mentioned above and see how it then does shrink/grow

Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tw15egancommented, Nov 4, 2022

@ariellalgilmore Yes I believe that is the design spec

1reaction
tw15egancommented, Nov 4, 2022

@tay1orjones I would imagine it’s just to conform with other form elements that they expand to fill their container. We could probably update this to be an inline style and not apply the inline style if the col prop is passed down.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DCA: rows and cols doesn't work as expected for textarea ...
It seems that rows and cols keys for textarea in evaluation array doesn't work as expected. For example, I have this code in...
Read more >
Is a textarea's cols attribute supposed to indicate 1 less than ...
As a rule, you should not worry too much about this. Set the cols attribute according to what you expect to be most...
Read more >
33654 - TEXTAREA incorrectly applying ROWS= and COLS ...
TEXTAREA incorrectly applying ROWS= and COLS= (horizontal / vertical scrollbar extra space, with overlay scrollbars disabled)
Read more >
7 - How do I control the number of cols in a textarea?
According to the Form API, you control the number of columns in a textarea with the #cols attribute. However, setting this seems to...
Read more >
HTML textarea tag - W3Schools
The size of a text area is specified by the cols and rows attributes (or with ... Specifies a short hint that describes...
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