Skip to content

Conversation

@rebeccaalpert
Copy link
Member

@rebeccaalpert rebeccaalpert commented Jul 30, 2025

Languages that rely on IME keyboards may use the enter key for final text selection on Mac. The MessageBar also uses enter key for submit. The result was that IME input, such as Japanese, was prematurely submitted. I added an additional check for whether the onCompositionEnd event is complete and also added some additional handling for Safari, which is a little bit of a special case. This should resolve the issue on Mac. I manually checked Edge, Chrome, Safari, and Firefox on my machine with a Japanese keyboard.

Assisted-by: Cursor (used to generate boilerplate for handleCompositionStart/End, etc.)

https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/ helped me resolve the issue with Safari - we have to use "which" for now - the less-deprecated ways of checking just register an "Enter" key press with a different "which" value of 13. We want the 229 value.

Screen.Recording.2025-07-30.at.11.29.12.AM.mov

Turned on VoiceOver to see what would happen and it also seems to pick up the Japanese text in the VO announcements.

Tami Takamiya said this doesn't break him on Fedora - he was able to use Japanese successfully with the MessageBar prior to this change on Fedora 42 Workstation and after this change.

Don Labaj pulled up a Windows VM and it also seemed unaffected by this issue, but wasn't impacted by this change either. Same with when I tried on my Samsung phone.

Instructions on setting up Japanese keyboard on Mac: https://support.apple.com/guide/japanese-input-method/set-up-the-input-source-jpim10267/mac

Languages that rely on IME keyboards may use the enter key for final text selection on Mac. The MessageBar also uses enter key for submit. The result was that IME input, such as Japanese, was prematurely submitted. I added an additional check for whether the onCompositionEnd event is complete and also added some additional handling for Safari, which is a little bit of a special case. This should resolve the issue on Mac. I manually checked Edge, Chrome, Safari, and Firefox on my machine with a Japanese keyboard.

Assisted-by: Cursor (used to generate boilerplate for handleCompositionStart/End, etc.)
@patternfly-build
Copy link

patternfly-build commented Jul 30, 2025

@rebeccaalpert rebeccaalpert merged commit 748bfd7 into patternfly:main Aug 4, 2025
7 checks passed
@github-actions
Copy link

github-actions bot commented Aug 4, 2025

🎉 This PR is included in version 6.4.0-prerelease.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

rebeccaalpert added a commit to rebeccaalpert/virtual-assistant that referenced this pull request Oct 24, 2025
Languages that rely on IME keyboards may use the enter key for final text selection on Mac. The MessageBar also uses enter key for submit. The result was that IME input, such as Japanese, was prematurely submitted. I added an additional check for whether the onCompositionEnd event is complete and also added some additional handling for Safari, which is a little bit of a special case. This should resolve the issue on Mac. I manually checked Edge, Chrome, Safari, and Firefox on my machine with a Japanese keyboard.

Assisted-by: Cursor (used to generate boilerplate for handleCompositionStart/End, etc.)
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.

Message bar "submit on enter key" doesn't work well for Japanese, other languages

4 participants