Skip to content
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

Should <ins> and <del> have unicode-bidi: isolate? #5611

Closed
kojiishi opened this issue Jun 7, 2020 · 12 comments
Closed

Should <ins> and <del> have unicode-bidi: isolate? #5611

kojiishi opened this issue Jun 7, 2020 · 12 comments
Labels
addition/proposal New features or enhancements i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@kojiishi
Copy link

kojiishi commented Jun 7, 2020

How about adding unicode-bidi: isolate to <ins> and <del> in the default UA stylesheet?

Test: https://jsbin.com/vebabex/edit?html,output

When crbug.com/1053838 mentioned about <ins>f</ins>i forming a ligature, I remember we have applied unicode-bidi: isolate to string literals in our code search site to fix undesired reordering, and I wonder the same should apply to <ins> and <del> too.

If this is a good change for bidi, #5594 confirmed that unicode-bidi: isolate should isolate font shaping from surrounding context, so I think doing this can solve both issues.

Thoughts?

/cc @r12a @upsuper @jfkthame @litherum

@ebraminio
Copy link

ebraminio commented Jun 7, 2020

I don't like the fact it will make shaping to break for example in https://jsbin.com/katocurewu/edit which can be considered superfluous as I hadn't experience with something like that as MediaWiki doesn't have character by character diffs, but hmm, using a template coincidentally I've made for Wikimedia Commons here (broken in Mozilla, see this one in Chrome) it isn't that superfluous now I think more, but your case is also relatable, maybe something shouldn't UA stylesheet handle automagically however.

@jfkthame
Copy link

jfkthame commented Jun 7, 2020

It's not just shaping that breaks, this could also break things like bidi mirroring (well, arguable that's a form of shaping, perhaps). Consider https://codepen.io/jfkthame/pen/zYrGbPo for example: applying unicode-bidi: isolate to the <ins> and <del> elements causes them to render the wrong glyphs.

A better solution for the reported chromium issue would be to use ::before and ::after to insert ZWNJ each side of the <ins> or <del> element, if it is important to maintain separate coloring (though this would still break shaping in Ebrahim's example). I don't think this should be part of the default UA stylesheet, but a site that cares more about per-character color than about shaping might choose to do it.

@annevk annevk added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Jun 8, 2020
@aharon-lanin
Copy link

aharon-lanin commented Jun 8, 2020

  • The HTML spec (https://html.spec.whatwg.org/#non-replaced-elements) says which elements should get unicode-bidi:isolate. INS and DEL are not among them. Thus, regardless of whether we think it's a good idea or not, their styling should not be changed until the HTML spec says so.

  • IMO, it's probably a good idea for DEL, since the element is supposed to mean that that text is being deleted. Thus, it should not influence the display of the surrounding characters, and leave them looking as similar as possible to what they will look like when the text in the DEL is gone. By the same token, it is not a good idea for INS: the text is being inserted, and should therefore affect the display of the surrounding text as it would if the INS were removed (and the text inside it left behind).

@annevk
Copy link
Member

annevk commented Jun 8, 2020

@aharon-lanin I suspect you might have missed that this is the repository to discuss changes to that standard. 😉

@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Jun 8, 2020
@aharon-lanin
Copy link

Indeed! LOL. Of course I knew that, and just wanted to score brownie points by pointing out the importance of standards compliance :)

@kojiishi
Copy link
Author

kojiishi commented Jun 8, 2020

Thank you for all the feedback. With the feedback, I added some more test cases: https://jsbin.com/vebabex/edit?html,output

Without knowing what's more natural to bidi users, some seems to be more reasonable with isolate, some without isolate. It might vary by whether it's a code (and thus RTL characters appear only as string literals) or a document (such as wikipedia). And it might vary by whether it's inline diff or side-by-side diff. If the desired behavior depends on content, as @ebraminio said, maybe this should be up to page authors.

@jfkthame Bidi mirroring is a good point we should also consider. If the consensus is not to add isolate to <ins> and <del>, agree, inserting ZWNJ would be a good solution for ligatures.

How does people think on @aharon-lanin's idea to add only to <del>?

@jfkthame
Copy link

jfkthame commented Jun 8, 2020

How does people think on @aharon-lanin's idea to add only to ?

I can see how it'd make sense in some cases, at least, but I'm not sure it's universally good, and I'm uneasy about <ins> and <del> behaving differently by default; ISTM this would be quite surprising for authors.

So at the moment, my feeling is that all these ideas are things that an author could specify if they're considered suitable for their use case, but not put into the default stylesheet.

@kojiishi
Copy link
Author

Found an interesting test case using Fira Code:
https://jsbin.com/dupelal/edit?html,output

@aharon-lanin
Copy link

aharon-lanin commented Jun 24, 2020 via email

@jfkthame
Copy link

As would inserting a control using del::before and del::after to block the ligation.

(As it happens, inserting ZWNJ doesn't actually work with Fira Code; its "ligature" rules don't respect this. But other options such as ZWSP or Word Joiner do work to block it.)

@aharon-lanin
Copy link

aharon-lanin commented Jun 25, 2020 via email

@fantasai
Copy link
Contributor

FWIW, I agree with @jfkthame’s points here, and would also recommend no change to the spec.

@domenic domenic closed this as completed Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

8 participants