vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.57k stars 4.76k forks source link

plugin-search: Pressing the Enter key to finalize the converted text will cause a unintended page transition #2850

Open piyoppi opened 3 years ago

piyoppi commented 3 years ago

Bug report

When typing a text in the search box and pressing Enter to convert it, the active suggestion is selected, causing an unintended page transition. (In Japanese input, we often use the Enter key to confirm a character conversion.)

This issue was occered in a MacOS browsers (Chrome, Firefox). It was not reproduced in Windows OS.

Steps to reproduce

I add markdown file written in Japanese. https://github.com/piyoppi/vuepress/tree/demo-plugin-search-with-ime/packages/docs/docs/demo-for-japanese-input

It is including in the following branch. You can reproduce it by entering Japanese text (e.g. "タイトル") in the search box.

https://github.com/piyoppi/vuepress/tree/demo-plugin-search-with-ime

What is expected?

vuepress-expected

Pressing the Enter key to finalize the converted text will not cause a page transition.

What is actually happening?

vuepress-actual

Pressing the Enter key to finalize the converted text will cause a page transition.

Other relevant information

piyoppi commented 3 years ago

I tried to fix the issue using Implicit submission of Form.

https://github.com/piyoppi/vuepress/commit/89f26c66161bdb4571fb14bdba2ded6edd3647b8

I am going to submit a pull request.