ChromeOS, Sticky Keys and the issue with foreign characters invoked with the right Alt-key (AltGr)

I recently faced an interesting issue with a friend’s new Chromebook.

My friend has a disability and uses a single finger to write on her blog antybariera.pl. Because she wrote in Polish by default, to put special characters, like ąśćżęł, she would need to use key combinations. For that purpose, she would have to use two fingers, which is extremely difficult, if not impossible.

Chromebooks are equipped with useful accessibility features. I remember seeing something called a sticky key that, in theory, should work as follows.

To produce the character ę in Polish, press and hold the Alt key and then press the letter e.

Sticky Keys work in a way that allows you to single-press a key like Alt. This activates it and makes it behave as if held down with another finger. In the same way, you can double-press the Control key (like the Alt key) to make it act like it’s always pressed, similar to how the Caps Lock key typically behaves. This will allow you to type more than one special character in one run. If you don’t need to use the key any longer, you press it again (for the third time) to release it from serving the sticky key function.

That’s in theory.

This seemed like the perfect solution for my friend, but there’s one problem: it doesn’t work! At least, not as I expected.

I tested sticky keys on macOS (Sonoma) and Windows (11), and they worked as expected. However, on ChromeOS, sticky keys malfunctioned across various devices. I checked Chromebooks with both built-in and external keyboards, as well as ChromeOS Flex on PC.

I decided to investigate that matter.

After reading more about it, I realized that we, as users, had oversimplified a few things based on our experience.

It’s common knowledge that pressing the left Alt key in combination with F4 forcefully closes an application or window. Conversely, on a Polish keyboard layout, pressing the right Alt key with e produces the letter ę.

The key positioned on the left side of the spacebar is the regular Alt key. The other key, on the right side, is typically called Alt Gr (or Alt Graph). This Alt Gr key is responsible for invoking special characters specific to different languages, especially useful for those who don’t use an English keyboard layout.

When Sticky Keys are enabled on Chromebook (ChromeOS or ChromeOS Flex), it incorrectly recognizes both the left and right keys as ordinary Alt keys.

I suspected this might be an issue only with external keyboards, but I also checked a branded Chromebook’s built-in keyboard. It also has the AltGr key on the right side of the spacebar.

When typing with regular key combinations or using multiple fingers, the right Alt key works correctly as the AltGr key. However, when Sticky Keys is enabled, it treats the right Alt as a regular Alt key, and in such a way it’s highlighted.

This is confirmed by on-screen notifications that appear in the top-left part of the screen when Sticky Keys are on and the relevant key is pressed, as seen below.

Sticky Keys notification when pressed n ChromeOS Flex

Here’s the confusing part: the screenshot shows an altgr option, even though Chromebook treats both single and double presses of the left or right Alt key as a standard Alt key when Sticky Keys are on. This contradicts what’s displayed on the keyboard itself.

When I activated the on-screen keyboard, it correctly showed the AltGr key positioned to the right of the spacebar, just as a physical keyboard should have.

If Sticky Keys are supposed to work with AltGr, then how do we actually use them together?

In my research, I found a website keyjs.dev that allows detecting what key has been pressed.

When I press the left Alt key, I get responses e.key=Alt and e.code=AltLeft. However, when I press the right Alt key (the AltGr key), I get e.code=AltRight but still e.key=Alt. This is likely where the confusion with Sticky Keys arises.

Following this up, I found a discussion on Reddit where someone wanted to create a custom Russian keyboard layout using AltGr for Cyrillic characters. This suggests that adding custom layouts to ChromeOS might be possible.

Part of his code looks like:

var AltGr = { PLAIN: "plain", ALTERNATE: "alternate" };
var Shift = { PLAIN: "plain", SHIFTED: "shifted" };

var lut = {
"KeyE": { "plain": {"plain": "ш", "shifted": "Ш"}, "alternate": {"plain": "щ", "shifted":"Щ"}, "code": "KeyE"},
};

This code defines the characters produced by different key combinations: pressing just the e key, pressing e with AltGr, and pressing e with Shift.

For my scenario, this will look this:

var lut = {
"KeyE": { "plain": {"plain": "e", "shifted": "E"}, "alternate": {"plain": "ę", "shifted":"Ę"}, "code": "KeyE"},
};

While creating a custom layout is a solution, it’s important to remember that the keyboard itself recognizes AltGr correctly when producing the ę symbol. The problem lies with Sticky Keys treating AltGr as a regular Alt key when enabled.

After reaching out to the Google Accessibility Team for help, I decided to explore the issue further while I awaited their response.

Based on another discussion on Reddit, it seems ChromeOS uses e.code to differentiate between the left and right Alt keys. The question remains: why doesn’t Sticky Keys recognize the right Alt (which is actually AltGr) and utilize it correctly?

Is there a way to modify e.code=AltRight so that Sticky Keys recognize it as AltGr?

I searched the official Google GitHub repository for extra keyboards for ChromeOS. Looking for instances of AltGr, I found it included for some languages.

I found something interesting in the bepo keyboard layout, which is designed for optimized French typing:

function updateAltGrState(keyData) {
  altGrState = (keyData.code == "AltRight") ? ((keyData.type == "keydown") ? AltGr.ALTERNATE : AltGr.PLAIN)
                                              : altGrState;

I found similar references to AltGr usage in Esperanto and Dvorak (both left and right-handed layouts), as well as some extended functionalities within the UK Extended layout.

In the file composekey/background.js I noticed an entry:

// Default to keeping the modifier: otherwise, the default AltRight compose
// key conflicts with AltGr in international layouts.
keepModifier: true,

Based on that finding, I looked into the Compose Key for Chrome OS to see what it does.

So, here’s what I learned from the Compose Key info…

This extension turns the right Alt key (the trigger key is configurable) into a Compose key on a variety of different English keyboard layouts including US, Canadian, and UK.

This suggests a further step is needed to enable the AltGr functionality. Simply adding a layout, like English (UK) with Dvorak, doesn’t address the issue of Sticky Keys not recognizing the right Alt key as AltGr.

I found the Compose Key extension in the Chrome Web Store and decided to install it.

As we read:

This extension adds several keyboard layouts with a compose key to Chrome OS.

I was not optimistic when I read one of the comments left:

No longer works on Chrome OS & Chrome OS Flex version Version 99.0.4844.94

And the comment was right.

The instructions on enabling the Compose Key input method point to settings that no longer exist in the same way.

ComposeKey Initial Setup

Fortunately, I was able to find the necessary input method within the settings menu.

Add input method ComposeKey

After logging out and logging back in as recommended, I hoped to see the on-screen notification for Sticky Keys finally recognize AltGr correctly. Unfortunately, this wasn’t the case.

Since I haven’t heard back from the Google Accessibility Team yet, I’ve decided to ask this question elsewhere.

I began my search on the Chromium community forum. There, it became clear that this appears to be a bug within the system itself."

Following the recommendation, I’ve created a Tracked Bug (#325633307) to see how this progresses. In the meantime, I’ve also updated the Google Accessibility Team via email about the opened case in case they’d like to be kept informed.

While waiting for a response, I decided to test Sticky Keys with different language input methods. I installed several and observed their behaviour. Unfortunately, none of them reported the activation of AltGr when pressing the right Alt Gr key on the keyboard.

I’m at a dead end for now. Maybe a fresh start later will help.

 <script async delay="https://dariusz.wieckiewicz.org/g/serve.js?client=ca-pub-5380116874441486"
      crossorigin="anonymous"></script>
 <ins class="adsbygoogle"
      style="display:block; text-align:center;"
      data-ad-layout="in-article"
      data-ad-format="fluid"
      data-ad-client="ca-pub-5380116874441486"
      data-ad-slot="9220966978"></ins>
 <script>
      (adsbygoogle = window.adsbygoogle || []).push({});
 </script>

Despite my tracked bug not making any progress, I received further communication from the Google Accessibility Team. They requested some additional information to help them troubleshoot the issue.

Meanwhile, my tracked bug gained traction within the Google team, and after a month, it was addressed.

The team clearly understands the issue and has begun working on a fix.

Their investigation identified the root cause of the problem. A potential fix has been implemented for testing purposes and integrated into the development version of ChromeOS 125.0.6380.0.

I can’t test the fix just yet. While my laptop runs ChromeOS in the Dev Channel, it’s on version 124.

Assuming the fix is successful, I wonder how long it will take for it to reach the stable version of ChromeOS. Currently, the stable version is 122, Beta is 123, and Dev is 124.

It’s time to wait.

The day finally arrived! My device updated to the development version 125.0.6398.0. After restarting, I was eager to see if the AltGr recognition issue had finally been fixed.

And it does!

Success! With Sticky Keys enabled, pressing the right Alt key (AltGr) now shows altgr in the notification, as expected.

Fixes Sticky Keys in ChromeOS 125 with working AltGr

A quick test with some text composition confirms it: the fix is working perfectly!

Wow, I’m really impressed that they took my issue seriously and fixed it like that! I wasn’t sure it would happen at first, but the Google team really came through.

I revisited the website keyjs.dev to confirm the fix. Now, pressing the right Alt key (AltGr) returns e.key=AltGraph and e.code=AltRight. Previously, it only displayed e.key=Alt and e.code=AltRight.

While I’m happy to report the issue is resolved for me, my friend is unfortunately still facing the problem.

The fix is currently in version 125, while the stable ChromeOS version is 123 (two versions behind). I inquired with the team about the possibility of backporting this fix to the stable channel sooner, rather than waiting for version 125’s official release.

While backporting might be unlikely, there’s always a chance. In the meantime, we’ll have to wait for the stable release.

No worries! At least it’s fixed, and that’s going to be a big improvement for my friend’s writing.

Comments
Categories