Skip to content
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-field] Text area content may become hidden and unscrollable on resize #1138

Closed
Haprog opened this issue Mar 19, 2020 · 0 comments · Fixed by #6840
Closed

[text-field] Text area content may become hidden and unscrollable on resize #1138

Haprog opened this issue Mar 19, 2020 · 0 comments · Fixed by #6840

Comments

@Haprog
Copy link
Contributor

Haprog commented Mar 19, 2020

Description

When there is a <vaadin-text-area> e.g. with width: 100% so that the width of the component changes when you resize the browser window for example, some of the text content may overflow from the bottom because the height of the text area does not automatically update when the width of the component changes. When this happens the behaviour seems buggy because scroll bar does not appear in this case and the height is not updated like it would be when typing into the text area.

Workaround: Call textArea._updateHeight() after the width has changed (e.g. on window resize event or using ResizeObserver).

See also https://stackoverflow.com/q/60675038/1362634 for more context.

Expected outcome

When the text area has e.g. a few lines of text and the width becomes smaller (e.g. due to resizing the window to be narrower when text area has width 100%) so that the text starts wrapping to more lines, the height of the text area should automatically be expanded in the same way as it does when you type into the field.

Actual outcome

The height does not expand on width resize with overflowing text and scroll bar doesn't appear making it so that you can only scroll the text by using keyboard (e.g. arrow keys). Even if the text area already has a vertical scroll bar (like in the max-height demo) you can't scroll all the content if it wraps to more lines due to resize.

Live Demo

https://cdn.vaadin.com/vaadin-text-field/2.5.4/demo/#text-area-demos

Steps to reproduce

  1. Give the first text area on the page width: 100%
  2. Add some text e.g. gfaljfhg kas ghaf glkfaj g fa göfsah galjs hgalkjfs gfsa gljfsa gaflks gfaljs hgfa slkj gfaks lkjghfsa gkfsa hgkfsa g aflkj gljfa galkjfs glkjfsa gkjfsa gkjla glkjfsa hglkjfsa hgaslkjf gfalkjhgfalkj gfa glkjfsa hgfsalkj hgsaf hfagfa hfas lkjgfsa glkjlkjfsa hgkjfsa hgalkjfs glkjfsa hglkjfsa hgkljfsa hgkfsah
  3. Resize the browser window smaller so that the text starts wrapping to more lines than originally.
@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-text-field May 19, 2021
@web-padawan web-padawan changed the title Text area content may become hidden and unscrollable on resize [text-field] Text area content may become hidden and unscrollable on resize Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants