type
status
date
slug
summary
tags
category
icon
password
Ever experienced that feeling when you're trying to use ChatGPT on Safari, gently hitting the enter key to confirm your English input within a Chinese input method, but to your surprise, the message just sends? Yes, I've been there too. Let's tackle this issue together.

Stumbling Upon the Issue

On a regular workday, I was engaging in a conversation on ChatGPT with a model, attempting to input English words using the Chinese input method. But every time I tried to confirm my English input, the enter key seemed to have a mind of its own, sending the message directly. Quite a baffling encounter.

Delving Deeper

At first, I speculated: was it just an issue on my end? Testing on Chrome and Firefox, everything seemed to be in order. This only deepened my curiosity. Why was this happening solely on Safari? Naturally, I turned to the tech community to unearth some answers.

Pinpointing the Cause

It turned out that Safari handles event.isComposing a tad differently from other browsers. Under typical scenarios, when we use an input method like Chinese to type, other browsers mark event.isComposing as true, indicating we're still in the midst of typing. Thus, hitting the enter key is presumed to confirm input, not perform another action like sending a message.
However, Safari seems to miss out on this logic.
This piece of code is our savior. When the key's keyCode equals 229 (indicating it's being processed by the input method), it stops the event from further propagation, averting the unintentional message sending.

Resolutions

Bookmark Tool: A straightforward fix is crafting a JavaScript bookmark tool. While direct, the catch is you have to manually activate it every time you access the site.
User Script: Stumbling upon a user script online seemed like providence. With tools like Tampermonkey, this script can be effortlessly executed to mend the glitch.
Safari Extension: For those who lean towards a more durable and stable solution, forging a Safari extension is a prime choice. Nonetheless, it does demand a more extensive tech know-how.
The tech community's vigor when faced with such issues never ceases to amaze. I'm elated to share my journey and aid others who might be grappling with this quirky problem. If you've got alternative fixes or feedback, I'd be thrilled to hear them!
当ChatGPT自我审视其系统提示:深挖AI指引的复杂性Safari 浏览器、中文输入法与ChatGPT:修复一个不那么友好的交互问题