From what I understand the In-Context editor wraps strings in a <span> element when there’s characters (including whitespace) before and/or after the string. When there isn’t, it attaches itself to the existing element. Is it possible to consistently add a <span> element? I looked at using a before_dom_insert callback, but that happens too late.
For context, we’ve just enabled the editor and I’m looking to provide a more consistent experience without having to change our HTML.
For example, one of these headings here has whitespace around the text (where a <span> is added) and the other doesn’t, leading to different size selectors:
Similarly, these <li> containing plain text have an ::after psuedo-element to add the dot, but without wrapping the text in an element the psuedo-element is included in the selector:
As promised, we checked this question with our product team, and after discussion, it was decided not to change the current system behavior.
If it changed, it would be on the global product level (for all users), and as we haven’t received any similar reports yet (you’re the first person who noticed/asked about this), we are unsure if everyone would appreciate this change.
Still, we’ll keep an eye on this, and in case one day the product team decides to reconsider this - we will let you know