-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[text-area] Min/max rows attributes/properties #1399
Comments
Let’s keep this as an enhancement request for now. Add your ”+1” reaction if you really need this. |
The current way of controlling this is to use CSS vaadin-text-area {
min-height: 100px;
max-height: 300px;
} See live examples: https://vaadin.com/components/vaadin-text-field/html-examples#text-area-demos |
|
@lanmaster do mean that the field does not shrink to 10px? There's an issue about that: #1363 |
So take to consideration: |
Let me react to @jouni There is simple use case as TextArea can be only scroll entirely then you cannot use well prefix and suffix component as it is hard to e.g. place any content into middle in such suffix or prefix, because if it is scrollable than such component ends out of visible area ... so if you need content to be possibly seen to user all the time ... like buttons, advice, status indicator, data indicator, and so on you can not do that for TextArea. So if you needed that you have to add extra wrapping so than there is not reason for suffix and prefix component at all if there is no simple way to adjust that. So if there is not expectation to turn back rows as in previous version Vaadin than I would like to suggest to be possible to turn on just scrolling of "input-area". |
Thanks for the use case description, @netbeansuser2019! To me it seems like that’s a separate topic, whether or not the prefix and suffix elements scroll together with the text content (vs how to control the sizing of If I understood correctly, I think what you are asking is for a way to directly pass the As for the other use case (scrolling), that could also be opt-in/out (like you mentioned in vaadin/vaadin-text-field#506 ). Though, I admit that I don’t remember any concrete use cases where you’d want the prefix/suffix element to scroll with the text. Finally, as a workaround, you can achieve the desired scrolling behavior by using <vaadin-text-area>
<div slot="prefix">Prefix</div>
</vaadin-text-area>
<style>
[slot="prefix"] {
position: -webkit-sticky;
position: sticky;
top: 0;
}
</style> |
I do not think so it could be fixed by "sticky" in case of "middle". |
Not sure what you mean with ”middle” – can you elaborate? |
I mean like any icon shown in middle of visible area not in middle of entire scrollable area. |
Firstly this should be possible just from API. |
Hey, I’m just trying to help, provide a workaround 🤗 Perhaps it should be a built-in feature, but that’s probably not going to happen very soon, so we need to make due with workarounds until then. I didn’t test this this in all sorts of situations, so there probably are cases where sticky doesn’t work like you’d want it to. Would be great if you could provide example code. It’s a bit hard to understand the problem you described above. |
I tried to replicate the case that you described, the best I understood. Feel free to ”remix” the example: https://glitch.com/~peppermint-rambunctious-entree It does have an issue in Safari, where the sticky prefix element scrolls out of view (inside the text area) when you scroll far enough. |
Any update on including |
Workaround for Java, assuming there's an internal TextArea textArea = ...
textArea.getElement().executeJs("$0.getElementsByTagName('textarea')[0].setAttribute('rows','1');$0.getElementsByTagName('textarea')[0].style.minHeight = 0;", textArea.getElement()); |
Although it's already been linked from this issue, I'll just reiterate that this is related to #1363 |
Controlling the minimum and maximum height of the
text-area
is a common thing. Some DX/UX tests participants were expecting to see attributes for doing that. Should we introduce those or something likemin-rows
,max-rows
that will be standing for height?The text was updated successfully, but these errors were encountered: