[Webkit-unassigned] [Bug 212292] New: Setting textarea value from Javascript corrupts cursor position on backspace

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 22 17:06:20 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=212292

            Bug ID: 212292
           Summary: Setting textarea value from Javascript corrupts cursor
                    position on backspace
           Product: WebKit
           Version: Safari 13
          Hardware: Macintosh
                OS: macOS 10.15
            Status: NEW
          Severity: Major
          Priority: P2
         Component: Forms
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jstanden+webkit at gmail.com
                CC: cdumez at apple.com, wenson_hsieh at apple.com

Created attachment 400093

  --> https://bugs.webkit.org/attachment.cgi?id=400093&action=review

A video demonstrating the bug

Overview:

In Safari 13.1 on macOS 10.14 and 10.15, setting a TEXTAREA's value through Javascript and deleting lines from the middle to the top with the DELETE/BACKSPACE key doesn't remove empty lines. This doesn't occur on any other browser tested (Chrome, Firefox, Opera, Brave, Edge).

Steps to Reproduce:

1. Navigate to the test case at: https://jsfiddle.net/d75xzjg0/3/

2. Insert the cursor on the empty line between 3 and 4.

3. Type DELETE/BACKSPACE six types to remove the lines for 3, 2, and 1.

Actual Result:

The text is removed but the empty lines remain. The position of the lines for 4, 5, and 6 do not change.

Expected Result:

We expect the newly empty lines to be removed with DELETE/BACKSPACE, so the lines for 4, 5, and 6 are pulled up to the top of the TEXTAREA. This is the behavior on other browsers, and the behavior of Safari prior to 13.1.

Notes:

I've attached a video demonstrating the issue.

If the jsFiddle is unavailable, the code to reproduce is:

~~~
<textarea rows="20" cols="50"></textarea>

<script type="text/javascript">
var sel = document.querySelector('textarea');

sel.value = "1\n2\n3\n\n4\n5\n6\n";
</script>
~~~

The issue occurs whether the newlines of the inserted text are CRLF or LF.

The issue also persists whether or not there is default text in the TEXTAREA.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200523/969f78bb/attachment.htm>


More information about the webkit-unassigned mailing list