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

fix(web): fixes key-cap font scaling when very small text is required #11207

Closed
wants to merge 1 commit into from

Conversation

jahorton
Copy link
Contributor

@jahorton jahorton commented Apr 11, 2024

Fixes #11203.

It turns out that mobile-device browsers like to apply a minimum to font-size specs based on relative-style font scaling. Chrome will also threshold fixed-size font scaling within WebViews unless told otherwise. This tends to make larger key caps scale improperly on the keyboard, so to get a clean render, the easiest way forward on our end is to use font-size specs that the mobile WebViews will actually listen to.

User Testing

  • TEST_IPHONE_APP: Using Keyman within the Keyman app on a narrow iOS phone, verify that the default display-name for Khmer Angkor does not overrun the spacebar's area.

    • If other keys' text size seems unusual compared to normal, FAIL this test. They should be the same size as usual.
  • TEST_ANDROID_APP: Using Keyman within the Keyman app on a narrow Android phone, verify that the default display-name for Khmer Angkor does not overrun the spacebar's area.

    • If other keys' text size seems unusual compared to normal, FAIL this test. They should be the same size as usual.
  • TEST_IPHONE_STANDALONE: Using KeymanWeb via the "Test page for automatic key-cap scaling" on a narrow iOS phone, verify that each key's text is properly scaled, not overrunning its key's boundaries.

    • The two keys between g and l have the following key-cap text: ሴሴሴሴሴ
  • TEST_ANDROID_STANDALONE: Using KeymanWeb via the "Test page for automatic key-cap scaling" on a narrow Android phone, verify that each key's text is properly scaled, not overrunning its key's boundaries.

    • The two keys between g and l have the following key-cap text: ሴሴሴሴሴ

@jahorton jahorton added this to the B17S5 milestone Apr 11, 2024
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels Apr 11, 2024
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Apr 11, 2024

User Test Results

Test specification and instructions

  • TEST_IPHONE_APP (PASSED): Tested with the attached PR build (Keyman 17.0.305-beta-test-11207) on an iPhone 13 Mobile device and here is my observation: 1. Downloaded and installed Khmer Angkor keyboard. 2. Switched to Khmer Angkor keyboard. Verified that the default display-name for Khmer Angkor keyboard appears correctly on the spacebar area. Seems to be working fine. (notes)
  • TEST_ANDROID_APP (PASSED): Tested with the attached PR build (Keyman 17.0.305-beta-test-11207) on an Android 13 Mobile device and here is my observation: 1. Downloaded and installed Khmer Angkor keyboard. 2. Switched to Khmer Angkor keyboard. Verified that the default display-name for Khmer Angkor keyboard appears correctly on the spacebar area. Seems to be working fine.
  • 🟥 TEST_IPHONE_STANDALONE (FAILED): 1. Opened the 'Test page for automatic key-cap scaling' on a narrow iOS phone. 2. Noticed that the key-cap text ሴሴሴሴሴ is not properly scaled and they are overrunning its key boundaries. 3. Tested in both Chrome and Safari browsers and observed the same result. (notes)
  • TEST_ANDROID_STANDALONE (PASSED): 1. Opened the 'Test page for automatic key-cap scaling' on an Android 13 Mobile phone. 2. Verified that the key-cap text ሴሴሴሴሴ is appeared correctly on the keyboard. (notes)
Retesting Template
@keymanapp-test-bot retest TEST_IPHONE_STANDALONE

@@ -229,7 +229,7 @@ public void initKMKeyboard(final Context context) {

getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
getSettings().setSupportZoom(false);

getSettings().setMinimumFontSize(4);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could go as low as 1 (as in, 1px), but that might become too unreadable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can we add the units (px?) in a comment?
  2. How come iOS doesn't need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re point 2... good question. I guess it's a matter of the decisions by the devs of each browser? I documented my investigation and its results on the base issue.

Point 1 - sure, why not?

@jahorton
Copy link
Contributor Author

jahorton commented Apr 11, 2024

I do consider this to be a somewhat debatable fix. Here's what the results of TEST_IPHONE_STANDALONE look like on my personal iPhone SE 2 (via local build):

Test keyboard with some small key caps

I scaled the image down from its original resolution to better approximate the actual size when on the physical device. Even then, this image appears, to me, notably larger than my actual phone.

We're talking about forcing some small key-caps here.

Base automatically changed from feat/web/vkbd-layout-optimization to beta April 12, 2024 00:49
@darcywong00 darcywong00 modified the milestones: B17S5, B17S6 Apr 12, 2024
@bharanidharanj
Copy link

Test Results

  • TEST_IPHONE_APP (PASSED): Tested with the attached PR build (Keyman 17.0.305-beta-test-11207) on an iPhone 13 Mobile device and here is my observation: 1. Downloaded and installed Khmer Angkor keyboard. 2. Switched to Khmer Angkor keyboard. Verified that the default display-name for Khmer Angkor keyboard appears correctly on the spacebar area. Seems to be working fine.

..Khmer_Angkor Caption in spacebar

  • TEST_IPHONE_STANDALONE (FAILED): 1. Opened the 'Test page for automatic key-cap scaling' on a narrow iOS phone. 2. Noticed that the key-cap text ሴሴሴሴሴ is not properly scaled and they are overrunning its key boundaries. 3. Tested in both Chrome and Safari browsers and observed the same result.

..in Chrome browser

..in Safari browser

@bharanidharanj
Copy link

Test Results

  • TEST_ANDROID_APP (PASSED): Tested with the attached PR build (Keyman 17.0.305-beta-test-11207) on an Android 13 Mobile device and here is my observation: 1. Downloaded and installed Khmer Angkor keyboard. 2. Switched to Khmer Angkor keyboard. Verified that the default display-name for Khmer Angkor keyboard appears correctly on the spacebar area. Seems to be working fine.

  • TEST_ANDROID_STANDALONE (PASSED): 1. Opened the 'Test page for automatic key-cap scaling' on an Android 13 Mobile phone. 2. Verified that the key-cap text ሴሴሴሴሴ is appeared correctly on the keyboard.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Apr 12, 2024
@mcdurdin
Copy link
Member

I do consider this to be a somewhat debatable fix.

Agreed, I feel like this is not addressing the actual problem, which is that there is too much text to fit on the key cap. So, we need to shorten the spacebar text, and encourage keyboard designers to avoid putting too much text on a key. Scaling to something unreadable doesn't really help anyone.

@jahorton
Copy link
Contributor Author

For the space bar caption, isn't the language name automatically sourced? Like, from the Ethnologue or similar?

If so, that part is out of keyboard designers' hands and may need its own, additional look.

@mcdurdin
Copy link
Member

For the space bar caption, isn't the language name automatically sourced? Like, from the Ethnologue or similar?

If so, that part is out of keyboard designers' hands and may need its own, additional look.

Yes, if I wasn't clear in my previous comment, I see two actions:

  1. Shorten spacebar text
  2. Encourage keyboard devs to use short keycap labels

@jahorton
Copy link
Contributor Author

I do consider this to be a somewhat debatable fix.

Agreed, I feel like this is not addressing the actual problem, which is that there is too much text to fit on the key cap. So, we need to shorten the spacebar text, and encourage keyboard designers to avoid putting too much text on a key. Scaling to something unreadable doesn't really help anyone.

So, do we close this PR, or go ahead with its changes? I don't we should go any further than this within the OSK, but the spacebar-captioning aspect is already affecting real keyboards.

As for the previously-shown screenshot...

Test keyboard with some small key caps

Yeah, those key-caps were only ever intended to act as extremes. We definitely shouldn't encourage use of key caps like that. The spacebar caption text? That's accomplished via the keyboard's stub, which corresponds to the keyboard and language names baked into the KMP within the mobile apps. For khmer_angkor, the offender is the language name...

Where it is set within Developer - which is editable!

Huh, so we can actually edit it there... in which case a warning about "hey, that's a long language name" also becomes possible. Though... the threshold may need to vary per keyboard - Amharic doesn't exactly leave its spacebar much room.

Amharic's default layer, in order to show off its cramped, two-key wide spacebar

Yeah, language + keyboard name isn't going to fit well on that narrow fellow.

@mcdurdin
Copy link
Member

So, do we close this PR, or go ahead with its changes?

I think we abandon this PR. Spacebar text length is a longstanding issue which we need to do more design work on (see also #10699). v18.

@jahorton jahorton closed this Apr 17, 2024
@jahorton jahorton deleted the fix/web/extreme-keycap-scaling branch April 17, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(web): the in-app Khmer Angkor caption name doesn't fit on the OSK's Spacebar on mobile devices
5 participants