Last Comment Bug 668599 - Cannot enter new input in contenteditable area if there’s a text selection inside of it
: Cannot enter new input in contenteditable area if there’s a text selection in...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Editor (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal with 1 vote (vote)
: mozilla8
Assigned To: Fabien Cazenave [:kaze]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-30 12:20 PDT by Mathias Bynens
Modified: 2011-08-18 12:00 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Additional test case (545 bytes, text/plain)
2011-07-16 03:37 PDT, Tom Hindle
no flags Details
patch proposal (5.38 KB, patch)
2011-07-22 16:31 PDT, Fabien Cazenave [:kaze]
ehsan: review+
Details | Diff | Review

Description Mathias Bynens 2011-06-30 12:20:50 PDT
Test case:

data:text/html;charset=utf-8,%3C!DOCTYPE%20html%3E%3Ctitle%3ETest%3C%2Ftitle%3E%3Cp%3EThis%20is%20just%20%3Cb%20contenteditable%3Esome%20editable%20text%3C%2Fb%3E%3Cscript%3Edocument.querySelector('b').focus()%3C%2Fscript%3E

Open that page, select some text inside the bold contenteditable area, and start typing. Nothing happens.

The expected behavior is of course that the selected text would be replaced by the new input.
Comment 1 Vlad [QA] 2011-07-01 00:41:45 PDT
Can you provide a url?
I see a strange error in description.
Comment 2 Mathias Bynens 2011-07-01 01:18:18 PDT
(In reply to comment #1)
> Can you provide a url?
> I see a strange error in description.

That was the URL. I ran it through my URL shortener for your convenience: http://mths.be/bbg
Comment 3 Vlad [QA] 2011-07-01 02:15:07 PDT
WFM on  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0a1) Gecko/20110630 Firefox/7.0a1
If I select only the text (blue color) works fine, but if i select also the margins of the text field, it doesn't work(still blue color).

If I select the hole text field, also with the margins (grey color), doesn't work but i dont't think it should.
Comment 4 Tom Hindle 2011-07-16 03:37:54 PDT
Created attachment 546300 [details]
Additional test case

Additional test case attached.
Uses javascript to make a selection.
This only seems to occur if element is focused after the selection is made.
Comment 5 :Ehsan Akhgari (busy, don't ask for review please) 2011-07-18 13:20:10 PDT
This might be an interesting bug for you, I think.
Comment 6 Fabien Cazenave [:kaze] 2011-07-20 07:30:06 PDT
Looking into it. Note that this bug doesn't occur on block-level elements: replace the <span> with a <p> and everything works as expected.

(In reply to comment #4)
> This only seems to occur if element is focused after the selection is made.

Confirmed here.
Comment 7 Fabien Cazenave [:kaze] 2011-07-22 16:31:10 PDT
Created attachment 547841 [details] [diff] [review]
patch proposal
Comment 8 :Ehsan Akhgari (busy, don't ask for review please) 2011-07-25 14:10:57 PDT
Comment on attachment 547841 [details] [diff] [review]
patch proposal

r=me.  Can you please also file a followup bug for the issue with pressing Enter in the contenteditable span?  We need both these bugs fixed in Firefox 8.
Comment 9 Fabien Cazenave [:kaze] 2011-07-26 03:03:00 PDT
Sure! I have proposed a patch for that in bug 460740.
Comment 10 Marco Bonardo [::mak] 2011-07-26 04:09:04 PDT
http://hg.mozilla.org/mozilla-central/rev/167f6642efd4

Note that the changeset has been pushed with the wrong commit message, it points to a not-yet existing bug, plus this bug is unconfirmed but has a patch that has also been pushed? Ok, enough for today :) please pay attention in future.
Comment 11 Fabien Cazenave [:kaze] 2011-07-26 05:11:39 PDT
Sorry for the wrong bug number, I’ll be extra careful for the next ones.

Note You need to log in before you can comment on or make changes to this bug.