Open Bug 854272 Opened 7 years ago Updated 5 years ago

Undo breaks in a textarea when overflow property is changed.

Categories

(Core :: DOM: Editor, defect)

defect
Not set

Tracking

()

People

(Reporter: adel.smee, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22

Steps to reproduce:

I wrote this code to resize a textarea when the user types lots of stuff into it:


<html>
<head>
<script type="text/javascript">

function breakundo() {
    var myElement = document.getElementById("mine");
    myElement.style.overflow = "scroll";
    myElement.style.height = myElement.scrollHeight;
    myElement.style.overflow = "hidden";
}

</script>
</head>

<body>
    <form>
        <textarea id="mine" oninput="breakundo()" style="overflow: hidden">Placeholder</textarea>
    </form>
</body>
</html>

While your suggested method of resizing a textarea works (https://developer.mozilla.org/en-US/docs/DOM/HTMLTextAreaElement#Example_.231.3A_Autogrowing_textarea) it does a little hiccup every time the user types a new line, so I'd much prefer to get this way working as it is nice and smooth.


Actual results:

The problem is my users can no longer Undo any text typing they've done into the textarea.


Expected results:

Undo should work. If I get rid of this line:

myElement.style.overflow = "scroll";

... and just set the height to some number then Undo still works as I would expect.
This is a similar bug to: https://bugzilla.mozilla.org/show_bug.cgi?id=448784 but I don't require a focus or blur event to cause Undo to stop working.
Confirmed with Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20130325 Firefox/22.0 ID:20130325093524 CSet: 4d3250f3afea (FWIW, this never worked).

WFM in Chrome 27 and MSIE 10.
Status: UNCONFIRMED → NEW
Component: Untriaged → Layout: Form Controls
Ever confirmed: true
Keywords: testcase
OS: Mac OS X → All
Product: Firefox → Core
Hardware: x86 → All
Version: 19 Branch → Trunk
Component: Layout: Form Controls → Editor
You need to log in before you can comment on or make changes to this bug.