carbon icon indicating copy to clipboard operation
carbon copied to clipboard

If I set a className for max width on TextInput the invalid wrapper extends past it

Open scottdickerson opened this issue 5 years ago • 4 comments

What package(s) are you using?

  • [ ] carbon-components
  • [x] carbon-components-react

Detailed description

Describe in detail the issue you're having. I used the className prop of the TextInput to set a maxWidth on the input field for certain TextInput types. It works! Unfortunately if the TextInput is invalid, the wrapper class highlights extend way beyond the max width of the Text Input. Can we also send the className prop along on the wrapper, or give a separate wrapper class prop that we can override?

Is this issue related to a specific component? TextInput

Additional information

image

scottdickerson avatar Jan 29 '20 18:01 scottdickerson

would you mind creating a reduced test case in Code Sandbox for easier testing and debugging?

emyarod avatar Jan 29 '20 19:01 emyarod

sure no problem: https://codesandbox.io/s/textinput-example-47zv7 @emyarod

scottdickerson avatar Jan 31 '20 13:01 scottdickerson

Confirmed. Seems like this is solved by passing the class down the wrapper instead of the input itself. Seems like this would be considered a breaking change since some users could be sending down a class they want to send to the input, so we may need to add a new prop to allow adding classes to the wrapper.

tw15egan avatar Jan 31 '20 19:01 tw15egan

since the wrapper element is still modifiable with an alternate selector I think that would be the workaround in this case. not sure if there's a definite fix for this

emyarod avatar Feb 11 '20 15:02 emyarod

Fixed with v11.

sstrubberg avatar Nov 14 '22 16:11 sstrubberg