-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Textarea: Resize improvements, handle, paste etc #1968
Conversation
🦋 Changeset statusBased on the included changeset, the following releases will be published as a result of this PR:
Note: If unpublished changesets where merged to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things come to mind:
- On the
resizable
property, themanual
option should allow the user to resize by handle only. So in that mode there should be no automatic resize based on content, only manual resize by the user. In the other modes, no resize handle should be present at all. Currently it looks like theresizable
property is not used at all? It's not being read anywhere in the code. - See if you can set the CSS
resize
property on the#field
element instead. It may require some minor changes to field-base, but then we would get the handle always in the corner. But skip if it turns out to be a rabbit hole :)
…green into textarea/patch-resizing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connectedCallback(): void { | ||
super.connectedCallback() | ||
TransitionalStyles.instance.apply(this, 'gds-field-base') | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be here for Transitional styles to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add it back, not sure why I removed it on the first place!
if ( | ||
element.value === '' || | ||
this.resizable === 'false' || | ||
this.resizable === 'manual' | ||
) { | ||
// If the textarea is empty, reset to the default number of rows | ||
this.rows = this._defaultRows | ||
// Clear any manual resize height | ||
element.style.height = '' | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this bit can be removed entirely now?
In particular, the behavior when you paste in a manual
field is a bit unexpected:
- Make the field larger using the resize handle
- Paste a large chunk of text
- You would expect the field to stay the same size, but instead it shrinks to initial size
This PR fixes the following: