Skip to content

Vaadin text area is unusable in firefox with large amounts of text.  #452

Closed
vaadin/vaadin-text-field
#568

Description

@jsalts

Description of the bug / feature

Vaadin text area is broken in firefox when using backspace with large amounts of text.

Minimal reproducible example

  1. Download vaadin my-starter-project
  2. On the home view, add a textarea to the content panel.
  3. Perform the steps in this screencast.
    a. Populate the text area with a large amount of text.
    b. Scroll near the bottom.
    c. Attempt to delete a character using the backspace key. After hitting the backspace key once, the screen jumps up, making further text entry extremely difficult. The issue is specific to firefox and the vaadin text area component. The html textarea tag is not affected, so it is likely to do with the vaadin styling attached to the text area.

https://www.screencast.com/t/KMMoS3JQbT

Expected behavior

The browser should not jump around.

Actual behavior

The browser jumps, making typing impossible.

Versions:

- Vaadin / Flow version: 14.4.1
- Java version: Java 11
- OS version: 10.15.7 osx. 
- Browser version (if applicable): firefox 83 (works in chrome)

Activity

  1. transferred this issue fromvaadin/flowon Nov 26, 2020
  2. web-padawan commented on Dec 3, 2020

    @web-padawan
    Member

    Possibly related: angular/material#3070

  3. jsalts commented on Dec 7, 2020

    @jsalts
    Author

    FWIW setting max-height does help, but only if the max-height is less than 350px. In our use case we prefer to have larger sizes for the text area.

  4. self-assigned this
    on Feb 8, 2021
  5. jsalts commented on Apr 29, 2021

    @jsalts
    Author

    Issue hasn't been fixed and now happens in chrome. The scroll happens when this line is executed.

    this.value = e.target.value;

    This ends up triggering _updateHeight() in vaadin-text-area.js, which calls input.style.height = 'auto'; in a special case where content is deleted, which causes the unexpected scroll events (testing in osx / latest chrome). Removing the height = auto line makes the text area perform normally. @tomivirkki could you take another look at this?

    https://github.com/vaadin/vaadin-text-field/blob/671a849c996f4b6728f28a39966add9df9e4d920/src/vaadin-text-area.js#L196

    The issue also only occurs in certain situations. When the input is set to auto, it shrinks to only a few px tall. If the page has offscreen content at that point (e.g. more scrollable content), the text area will behave correctly. If the height = auto assignment causes the screen to hit the bottom of the page, the bug occurs (in firefox and chrome). Basically, the bug happens on mostly on pages with limited amounts of other content, where the height = auto assignment causes us to hit the bottom of the page and thus lose scroll height information we need for updateHeight() to function properly.

    In my testing removing the height = auto assignment fixes everything, but I don't really have the insight to say why it was included originally.

  6. tomivirkki commented on Apr 29, 2021

    @tomivirkki
    Member

    Hi @jsalts, if there's a regression or a related bug, please open a new GH issue (and reference this one) so it gets triaged properly. This one has already been closed/archived.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions