Cannot backspace out of list at start of contentEditable region
https://bugs.webkit.org/show_bug.cgi?id=24362
Summary Cannot backspace out of list at start of contentEditable region
Annie Sullivan
Reported 2009-03-04 10:48:32 PST
Steps to reproduce: 1. Go to Midas Demo: http://www.mozilla.org/editor/midasdemo/ 2. Check "View HTML Source" and type the following HTML: <ul><li>a</li></ul> 3. Uncheck "View HTML Source" and put the cursor before the 'a' character. 4. Press backspace. Actual result: Nothing happens Expected result: List item deleted. This affects Google Docs. Possibly related to bug 11331?
Attachments
Eric Seidel (no email)
Comment 1 2009-03-06 11:48:33 PST
There seems to be code to specifically enable this: void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing) // When the caret is at the start of the editable area in an empty list item, break out of the list item. if (endingSelection().visibleStart().previous(true).isNull()) { if (breakOutOfEmptyListItem()) { typingAddedToOpenCommand(); return; } } Obviously that code is not working. :) Will investigate.
Eric Seidel (no email)
Comment 2 2009-03-06 12:29:13 PST
Oh, that code is working fine. This bug is asking to be able to remove the list item even when the list item isn't empty. :)
Ryosuke Niwa
Comment 3 2009-08-14 18:15:46 PDT
(In reply to comment #2) > Oh, that code is working fine. This bug is asking to be able to remove the > list item even when the list item isn't empty. :) Firefox and TextEdit on Mac removes the bullet (i.e. unlistify the text). I think we should fix this behavior.
Tony Chang
Comment 4 2010-02-21 21:32:01 PST
(In reply to comment #3) > (In reply to comment #2) > > Oh, that code is working fine. This bug is asking to be able to remove the > > list item even when the list item isn't empty. :) > > Firefox and TextEdit on Mac removes the bullet (i.e. unlistify the text). I > think we should fix this behavior. To clarify: Firefox only removes the bullet if it's the first item in the list. Otherwise, it merges with the previous list item. I will investigate.
Tony Chang
Comment 5 2010-02-22 19:42:36 PST
Ok, I think we want to go with IE's and TextEdit's behavior here. If the cursor is at the beginning of a list item, it unindents it. Once unindented, pressing backspace a second time merges the text with the previous item. Before I can fix the list behavior, I need to fix bug 35281 (otherwise, the second backspace would result in two separate lists).
Aryeh Gregor
Comment 6 2011-08-18 13:30:46 PDT
The behavior I specced is roughly * If at the beginning of the first <li> in the list, unindent the <li>, leaving it on a separate line from whatever is before it. Then a second backspace merges it into the previous block. * If at the beginning of an <li> that's not the first in the list, merge with the previous <li>, keeping the contents on separate lines (add <br> if necessary). Then a second backspace merges it to the same line as the previous item. http://aryeh.name/spec/editing/editing.html#the-delete-command According to my notes, this behavior doesn't match any browser, but I felt it made more sense than what any browser did.
Shezan Baig
Comment 7 2013-03-15 07:22:53 PDT
Can I submit a patch for this bug without waiting for bug 35281? The fix for this seems much simpler. The fact that the second backspace doesn't merge the lists is an issue that only happens if there is a previous list item, and that isn't the case here. This bug is specifically to do with being at the start of a contentEditable region, (and I would extend it to include start of table-cells), so by definition there is no previous list item. So I don't think it should be blocked by bug 35281.
Note You need to log in before you can comment on or make changes to this bug.