kimi-cli icon indicating copy to clipboard operation
kimi-cli copied to clipboard

klmi web 的附件按钮点击后会执行一次submit 再触发对应操作 || klmi web's attachment button will execute a submit once clicked and then trigger the corresponding operation.

Open HynoR opened this issue 8 months ago • 3 comments

What version of Kimi Code CLI is running?

1.21.0 Web

Which open platform/subscription were you using?

subscription

Which model were you using?

kimi-code

What platform is your computer?

MacOS

What issue are you seeing?

https://github.com/user-attachments/assets/7fc75d15-d214-41da-8a38-26afc64c1ab9

What steps can reproduce the bug?

输入任何内容,点击附件按钮,会触发submit,立刻发送输入框的文本。

What is the expected behavior?

No response

Additional information

No response


What version of Kimi Code CLI is running?

1.21.0 Web

Which open platform/subscription were you using?

subscription

Which model were you using?

kimi-code

What platform is your computer?

MacOS

What issue are you seeing?

https://github.com/user-attachments/assets/7fc75d15-d214-41da-8a38-26afc64c1ab9

What steps can reproduce the bug?

Enter any content and click the attachment button, which will trigger submit and send the text of the input box immediately.

What is the expected behavior?

No response

Additional information

No response

HynoR avatar Mar 13 '26 02:03 HynoR

🚨 NEXA CLIENT DETECTED

CLIENT: HynoR

BUG: klmi web 的附件按钮点击后会执行一次submit 再触发对应操作 || klmi web's attachment button will execute a submit once clicked and then trigger the corresponding operation.

PRICE: LOW

I took a quick look at this problem.

Happy to share the full patch here: https://buy.stripe.com/3cI9ASa2Pc9AbtofVy0gw06

-Luciano

FocusMode-coder avatar Mar 13 '26 02:03 FocusMode-coder

Even though PromptInputButton sets type='button', the click event can still propagate and trigger the parent form's submit handler in some browsers. Adding event.preventDefault() and event.stopPropagation() to the click handler ensures only the file dialog opens.

Br1an67 avatar Mar 17 '26 06:03 Br1an67

Root cause identified: the attachment button (and other toolbar buttons) in the prompt composer footer are rendered inside the PromptInput form element. Without an explicit type="button", HTML buttons default to type="submit", causing the form to submit and send the message when clicked.

Fix: Added type="button" to all toolbar buttons (attachment, model selector, force restart, reload) to prevent unintended form submission.

PR incoming.

Br1an67 avatar Mar 20 '26 00:03 Br1an67