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

fix: remove textarea autofocus #110

Merged
merged 1 commit into from
Sep 28, 2024
Merged

fix: remove textarea autofocus #110

merged 1 commit into from
Sep 28, 2024

Conversation

Enter-tainer
Copy link
Member

fix #103

现在每次点击被评论的段落时,焦点会被移动到textarea里面,导致丢失选择的区间,没法复制内容,现在把这个关掉了

cc @ikkz

@ikkz
Copy link
Contributor

ikkz commented Sep 28, 2024

那点击段落右边的评论按钮,还有自动 focus 不

@Enter-tainer
Copy link
Member Author

也没有了。理论上好像是应该区分一下?

@Enter-tainer
Copy link
Member Author

image

不过我看代码的时候看到个有点奇怪的东西,这里是不是应该是 && 呀?

@Enter-tainer
Copy link
Member Author

尝试阅读了一下现在的代码,确实是有 @shaokeyibb 提到的判定的,如果是点击 paragraph 的话, focusReply 应该是会是 false 的

frontend/lib/main.ts Outdated Show resolved Hide resolved
@shaokeyibb
Copy link
Member

改成 && 我理解肯定是不对的🤔,这里感觉应该还是额外做一下特判才对

@Enter-tainer
Copy link
Member Author

改成 && 我理解肯定是不对的🤔,这里感觉应该还是额外做一下特判才对

我理解了一下这里的逻辑,似乎是说,如果有 comments,或者是强制指定了要 focus 过去(对应点击按钮的情况),那么打开边栏并 focus textarea

这里的逻辑大概是这样的,分几种情况:

  1. 没有评论的段落,点了之后无事发生
  2. 有评论的段落:点了之后会打开侧边栏并focus textarea
  3. 点击按钮:无论如何都打开侧边栏并focus textarea

实际上我们希望对于 2,不要 focus textarea

@Enter-tainer Enter-tainer force-pushed the mgt/remove-focus branch 2 times, most recently from fd9901c to e6ba21e Compare September 28, 2024 12:50
@Enter-tainer
Copy link
Member Author

Enter-tainer commented Sep 28, 2024

我改好了,但是我发现现在在本地好像根本没办法测试了(因为 github 登陆啥的好像不太work),或许 @shaokeyibb 可以有空导一份线上的数据,也可以用来进行本地的测试..

@Enter-tainer
Copy link
Member Author

(或者有没有更科学的测试的方法推荐

@Enter-tainer
Copy link
Member Author

本地测试 work 的

@Enter-tainer Enter-tainer merged commit 9f6e943 into master Sep 28, 2024
5 checks passed
@Enter-tainer Enter-tainer deleted the mgt/remove-focus branch September 28, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] 有评论的的段落无法选中一部分复制
3 participants