-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contenteditable re-creating deleted children when it shouldn't #468
Comments
Is this also something related? On Chrome, on contenteditable:
|
@saschanaz Yes, that seems related. Except that what you describe is on initial input. That seems equally incorrect. |
Hmm, prohibiting it breaks the traditional behavior. Empty inline elements are not visible for users. Therefore, for avoiding unnecessary inline empty elements to stay, builtin editors need to clean it up as soon as possible. (E.g., if empty inline elements are stay, they need to be cleaned up when Firefox supports |
From TPAC 2024 minutes:
|
Well, I think that the solution is reasonable. However, I'm not sure whether it's reasonable to delete the empty inline elements at a caret move if there is no surrounding text. E.g., in an empty paragraph or around <p><b>{}</b><img></p> <p><img><b>{}</b></p> <p><b>{}<br></b></p> etc. |
@masayuki-nakano Fine with me. It just seems that means that if you create a pure contenteditable editor (using execCommand and browser undo-stack), your content will be filled with empty inline nodes that the user cannot easily remove. That seems a bit weird, but if we say that the better choice is always to use a JavaScript-based editor that has its own undo-stack, then sure, why not, |
In Chromium (possibly others), when deleting an inline element inside an contenteditable ement such as a
<b>
or a<span>
and then typing a letter, the inline element gets recreated. This behavior is highly annoying for JavaScript editor creators. JavaScript devs have asked time and time for contenteditable to please stop trying to be "smart"and changing the dom in starneg ways.A bug has been filed before [1], but it was marked as "won't fix" due to some wording in the (unreleased) execCommand document.
This issue is now also causing additional issues [2].
My proposal: Change the execCommand draft document removing any language that may make browser developers think that such behavior is wanted [3], Chromium should reopen the bug [1] and make Chromium be compliant with the Input Events spec.
[1] https://bugs.chromium.org/p/chromium/issues/detail?id=506858&no_tracker_redirect=1
[2] w3c/input-events#158
[3] https://w3c.github.io/editing/docs/execCommand/#recording-and-restoring-overrides
The text was updated successfully, but these errors were encountered: