New issue
Advanced search Search tips

Issue 749729 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Setting textarea.defaultValue causes text caret to be lost

Reported by b...@benalpert.com, Jul 27 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3167.0 Safari/537.36

Steps to reproduce the problem:
With this code:

  <textarea id="x"></textarea>
  <script>
    x.addEventListener('input', function(e) {
      x.defaultValue = x.value;
    });
  </script>

Type into the textarea.

What is the expected behavior?
Typing should work.

What went wrong?
Focus is immediately lost.

Did this work before? Yes 

Does this work in other browsers? Yes

Chrome version: 62.0.3167.0  Channel: n/a
OS Version: OS X 10.12.6
Flash Version: 

You are probably looking for a change made after 489295 (known good), but no later than 489307 (first known bad).
CHANGELOG URL:
  https://chromium.googlesource.com/chromium/src/+log/463dc50e730013d2c12f913bebf8e417d9312789..9946c3ce2b116a954f25a63a19be1ba414b3be53

Looks like Shanmuga Pandi M <shanmuga.m@samsung.com>'s commit "Setting textArea.defaultValue should wipe out any children.": https://chromium.googlesource.com/chromium/src/+/6a53ba2305e2d0196d8f46f8590e0ad1fa45d636%5E%21/#F4
 

Comment 2 by tkent@chromium.org, Jul 28 2017

Components: -Blink>Forms Blink>Forms>Textarea
Labels: -Pri-2 Pri-1
Owner: tkent@chromium.org
Status: Started (was: Unconfirmed)
Summary: Setting textarea.defaultValue causes text caret to be lost (was: Setting textarea.defaultValue causes focus to be lost)
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c008e20c9be6564277df6faab48984c627028758

commit c008e20c9be6564277df6faab48984c627028758
Author: Kent Tamura <tkent@chromium.org>
Date: Fri Jul 28 04:02:19 2017

Revert "Setting textArea.defaultValue should wipe out any children."

This reverts commit 6a53ba2305e2d0196d8f46f8590e0ad1fa45d636.

Reason for revert: A serious regression.  crbug.com/749729 

Original change's description:
> Setting textArea.defaultValue should wipe out any children.
> 
> On setting, it must act as the setter for the element's
> textContent IDL attribute and it should not normalize line endings.
> 
> spec:
> https://html.spec.whatwg.org/multipage/form-elements.html#dom-textarea-defaultvalue
> 
> Bug:  737138 
> Change-Id: Ib4973e72b168b083e522d8fd91262a9868cf6523
> Reviewed-on: https://chromium-review.googlesource.com/579227
> Commit-Queue: Kent Tamura <tkent@chromium.org>
> Reviewed-by: Kent Tamura <tkent@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#489300}

TBR=tkent@chromium.org,shanmuga.m@samsung.com,domenic@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug:  737138 ,  749729 
Change-Id: Iadf1d385478f5545e1cf0c9ef903f4797557066e
Reviewed-on: https://chromium-review.googlesource.com/590827
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490253}
[add] https://crrev.com/c008e20c9be6564277df6faab48984c627028758/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-textarea-element/value-defaultValue-textContent-expected.txt
[modify] https://crrev.com/c008e20c9be6564277df6faab48984c627028758/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html
[modify] https://crrev.com/c008e20c9be6564277df6faab48984c627028758/third_party/WebKit/LayoutTests/fast/forms/textarea/textarea-selection-preservation-expected.txt
[modify] https://crrev.com/c008e20c9be6564277df6faab48984c627028758/third_party/WebKit/LayoutTests/fast/forms/textarea/textarea-selection-preservation.html
[modify] https://crrev.com/c008e20c9be6564277df6faab48984c627028758/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp

Comment 4 by tkent@chromium.org, Jul 28 2017

Labels: M-62
Status: Fixed (was: Started)
same issue is seen with "textContent".

<textarea id="x"></textarea>
  <script>
    x.addEventListener('input', function(e) {
      x.textContent= x.value;
    });
  </script>

Sign in to add a comment