Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Should backspace merge text with last cell's content of a table above ? #164
Let's consider the following example:
When placing the editing cursor at "T^esting", hitting backspace twice behaves differently in each browser:
When I tried on Chrome/Safari,
When I tried on Edge,
When I tried on Firefox:
Bear in mind that Chrome and Safari having the same behavior doesn't mean an explicit consensus; it's just that both engines still share the same codebase for that use case.
In a related but different case, note that if you select from "2" to "e" (inclusive), browsers also behave differently from each-other.
Similarly to the comment I left in #163 (comment), I wonder what is the best approach to specify this, assuming we can agree on the preferred behavior.
This one is more tricky. One might also expect it to select the table with the second backspace. Unless everyone can magically agree, I would think this is best left for JS editors to test and figure out and come up with a defacto standard over time, which then can be put into a spec.
I think that it's agreed that hitting backspace with the cursor set right after a table in the same line will select the whole table; further backspace hit will delete the whole table. I think this is the same behavior for images inside a contenteditable areas.
I think it makes sense that when placing the cursor in the text paragraph bellow, once reaching the start of the paragraph by hitting backspace it should be moved to the last position of the line above; in this case just after the table. Hence, we are in the scenario described above, where additional backspace hit will select the table.
It seems this issue is stalled. Considering that FF stops the backspace when reaching the beginning of the paragraph, could we agreed on that behavior as a compromise solution while we think on smarter ways if dealing with the table above ? I'll do the change in WebKit and Blink, so there will be 3 major browsers with the same behavior: clearly a win in terms of interoperability.
Besides the interoperability issue we have now, I think that merging the contents outside the table, from the paragraph bellow is really weird. I'd say more, it's a bug.
What do you think ?
Let me add some additional thoughts about this specific case and how it fir in the current spec.
1- This use case corresponds to section "9.12 The delete command" (same as hitting backspace).
In the note at the beginning, there is the following statement:
I really think the above statement is a bit ambiguous; using the the term "most" gives poor information. At least, we should list there the blocks we already consider not valid candidates for block merging. Maybe tables ?
2- This use case corresponds to the step 16 "General block-merging case."
I guess that we can consider that start node is
So, we are at start_node
So, start_node is set to the
Once we are here, we can indeed merge the anonymous block containing the rest of the text ("esting") with the contents of the
And here is where I see a contradiction in the current spec. The step 19 is precisely the section "9.5 Deleting the selection". In such section there is a note at the step 14 that states:
This statement implies that we can't merge contents of a different block into theelements. This is compatible with the ambiguous statement that I remarked at the beginning; so perhaps we can define tables a not valid candidates for block merging after all, as I suggested before.
Such note also states:
This is just a way of saying that there is no interoperability in this regard and I think the spec should aim for solving that issue. Considering that FF and Edge are compatible and that this proposal is to make Safari and Chrome follow that path, I think we should seriously considering it.
@johanneswilm could you add some feedback on this issue ? I'm trying to convince Chromium and Safari to change their behavior so both match Edge and Firefox, but I'd need some kind of consensus here before. It'd be a clear win in terms of interoperability, so I think it'd worth the effort.
I've been checking out other editor's behavior and got the following, so far:
pushed a commit
Mar 28, 2018
I looked at Apple iCloud Pages in Safari on Mac -- it doesn't seem to follow the behavior of native apps there either. Instead it seems to not react at all the first time backspace is hit, and the second time it deletes the table. It doesn't merge content into the table