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

Learn > Channels/Recommended - Khmer channel/content card description text spans beyond its container in Firefox and IE #7749

Closed
metodimilevqa opened this issue Jan 20, 2021 · 8 comments
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend i18n Issues with fonts and translations in localizations TAG: ux update Improved user-facing feature

Comments

@metodimilevqa
Copy link

metodimilevqa commented Jan 20, 2021

Observed behavior

On the Learn > Channels tab a channel with Khmer language content has a description text that spans beyond its container. Experienced with Firefox and IE.
On the Learn > Recommended tab some items with Khmer language content have a description text that spans beyond their containers. The issue is also seen in the View more section of the Recommended tab. Experienced with Firefox and IE.

2021-01-20_102521

2021-01-20_104256

2021-01-20_105038

Expected behavior

The card descriptions text must fit its container.

Steps to reproduce

Preconditions: Khan Academy (Khmer) channel imported. Kolibri language set to Khmer.

  1. Login to Kolibri LP using Firefox or IE
  2. Click the hamburger menu
  3. Click Learn
  4. See how the channel/items description renders in the Channels/Recommended tabs

Context

Kolibri 0.14.6rc1
Windows 7 vm
Firefox 84.0.2 (32-bit)
IE 11.0.9600

@metodimilevqa metodimilevqa changed the title Learn > Channels - Khmer channel description text spans beyond its container in Firefox and IE Learn > Channels/Recommended - Khmer channel/content card description text spans beyond its container in Firefox and IE Jan 20, 2021
@jonboiser
Copy link
Contributor

jonboiser commented Jan 20, 2021

This looks related to #7750 and #5468 (and many others)

In Khmer orthography, spaces are not used between all words in phrases, which is why that description paragraph in the Khan Academy card has several long, unbroken strings. The original message in the code is also unbroken:

    Khan Academy ផ្តល់ជូននូវវីដេអូនិងលំហាត់គណិតវិទ្យា។ មុខវិជ្ជាទាំងអស់ត្រូវបានពន្យល់តាមរយៈវីដេអូដែលមានវិចារណញាណហើយមានលំហាត់ជាច្រើនដើម្បីជួយសិស្សឱ្យចេះស្ទាត់ជំនាញលើគំនិត។

And as noted in #5468, long strings like this can sometimes overflow their container. But it seems that there must be some mechanism browsers use to detect word boundaries in Khmer.

I'm thinking this might be an OS-dependent thing like lack of support for some opentype feature on Windows 7 if this isn't happening on newer OSs.

@metodimilevqa
Copy link
Author

Just a detail - seems that Chrome handles it correctly in Windows 7
2021-01-21_084953

@jonboiser
Copy link
Contributor

jonboiser commented Jan 21, 2021

This might be a general problem with SE Asian languages. Here's a group that is investigating the issue

https://github.com/w3c/sealreq (see issue 34, which I'm not linking so it won't junk up their issue tracker).

This comment might lead to a possible solution:

The CSS spec says "Scripts such as Thai, Lao, and Khmer, however, do not use spaces or punctuation to separate words. Although the zero width space (U+200B) can be used as an explicit word delimiter in these scripts, this practice is not common. As a result, a lexical resource is needed to correctly identify soft wrap opportunities in such texts.", but doesn't provide any specific rules or properties for Lao line-breaking.

Basically, some browsers (like Chrome) might have a Khmer dictionary that helps them find words in these long unbroken strings. If that dictionary isn't available, it can use other hints like the zero-width space (which the KA Khmer description string doesn't have). Maybe this can be fixed on the Studio side and Crowdin to explicitly insert these spaces at word boundaries.

This is pretty laborious, but we can maybe test this by editing the locale file and adding U+200B characters at random places and seeing if Win7/FF will break at those parts of the message.

@jonboiser jonboiser added the TAG: ux update Improved user-facing feature label Jan 21, 2021
@jonboiser jonboiser added the APP: Learn Re: Learn App (content, quizzes, lessons, etc.) label Feb 20, 2021
@jonboiser
Copy link
Contributor

jonboiser commented Mar 23, 2021

I just noticed on the shave.js page (the library that is supposed to handle the text truncation), there's an example of using shave in a non-spaced language. Maybe this example has some things we can try here. It just involves setting a {spaces: false} option.

https://codepen.io/yowainwright/pen/wzVgMp

@jonboiser jonboiser added the i18n Issues with fonts and translations in localizations label Mar 24, 2021
@rtibbles rtibbles added the TODO: needs QA re-review For stale issues that need to be revisited label Mar 18, 2022
@pcenov
Copy link
Member

pcenov commented Mar 22, 2022

@radinamatic this is no longer valid in 0.15.1 - the Khmer text doesn't overflow both in IE11 and Firefox. Still, it's probably worth mentioning that there are some 0 like characters displayed in IE11:
2022-03-22_15-23-13

@rtibbles
Copy link
Member

@indirectlylit do you have any ideas about incorrect Khmer characters in IE11?

@indirectlylit
Copy link
Contributor

indirectlylit commented Apr 1, 2022

Is the same behavior reproduced if the app language is switched to Khmer? I'm curious if it's missing characters only when the app language is something else.

IE11 ought to be using "basic" font-loading behaviors which are less efficient (no lazy-loading) but – if memory serves me correctly – ought to still be able to render all text correctly. Relatively recently, we noticed that IE was not behaving as expected and made this change: #8768

Here's the main branch point for testing. You might be able to reproduce this behavior in Chrome by forcing the first conditional to be false:

if (passesRequirements(browser, fontSwapSupportingBrowsers)) {
addFontStylesheetLink(plugin_data.fullCSSFileModern);
loadFullFontsImmediately();
} else {
addFontStylesheetLink(plugin_data.fullCSSFileBasic);
loadFullFontsProgressively();
}

@radinamatic radinamatic removed the TODO: needs QA re-review For stale issues that need to be revisited label Apr 4, 2022
@rtibbles rtibbles added this to the upcoming patch milestone Jul 28, 2022
@rtibbles
Copy link
Member

rtibbles commented Jan 3, 2024

The main issue here is fixed, and we are deprecating IE11, so I am closing this.

@rtibbles rtibbles closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend i18n Issues with fonts and translations in localizations TAG: ux update Improved user-facing feature
Projects
None yet
Development

No branches or pull requests

6 participants