Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 搜索框无法输入 s 和 / #386

Closed
Teiiiiiio opened this issue Aug 30, 2023 · 2 comments
Closed

bug: 搜索框无法输入 s 和 / #386

Teiiiiiio opened this issue Aug 30, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Teiiiiiio
Copy link
Contributor

Teiiiiiio commented Aug 30, 2023

Clear and concise description of the problem

Search.tsx

  document.addEventListener('keypress', (ev) => {
    if (ev.key === 's' || ev.key === '/') {
      const input = document.querySelector('#animegarden-search input');
      // @ts-ignore
      input?.focus();
      ev.preventDefault();
      ev.stopPropagation();
    }
  });

输入s或者/会focus到input上用于快速输入,我认为主页的搜索框无法输入s的行为很怪异
不确认这是否是有意的行为,所以我没有提交为bug issue

Suggested solution

可以保留/

Additional context

No response

@Teiiiiiio Teiiiiiio added the enhancement New feature or request label Aug 30, 2023
@yjl9903
Copy link
Owner

yjl9903 commented Aug 30, 2023

/ 和我的插件 (Vimium C) 冲突了,故意加了一个 s

确实输入 s 坏了

改成:

  1. 移除 s 快捷键, 换成 ctrl + k / ctrl + p / / 等吧, 不确定有无其它冲突
  2. 判一下是否已经 focus 到搜索框,未 focus 就 focus,否则正常输入

PR Welcome :)

@yjl9903 yjl9903 added bug Something isn't working good first issue Good for newcomers and removed enhancement New feature or request labels Aug 30, 2023
@yjl9903 yjl9903 changed the title 移除Search.tsx组件中按下's'时focus至input的监听事件 bug: 搜索框无法输入 s 和 / Aug 30, 2023
@Teiiiiiio
Copy link
Contributor Author

Teiiiiiio commented Aug 31, 2023

判一下是否已经 focus 到搜索框,未 focus 就 focus,否则正常输入

感觉这个更适合
fork之后发现已经更新成这个逻辑了XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants