fix(library): prevent right-click from deleting book group on Windows#487
Open
linze0721 wants to merge 1 commit into
Open
fix(library): prevent right-click from deleting book group on Windows#487linze0721 wants to merge 1 commit into
linze0721 wants to merge 1 commit into
Conversation
codedogQBY
requested changes
Jun 21, 2026
codedogQBY
left a comment
Owner
There was a problem hiding this comment.
中文:
验证 #487 时发现删除确认仍然有问题,需要修改后再合并。
失败场景:
- 首页分组卡片:右键打开菜单后点击“删除”,分组会在未点击确认的情况下被删除。预期:必须先弹出确认,并且只有用户明确确认后才调用 removeGroup;取消或未确认时不能删除。
- 左侧栏分组 chip:右键打开菜单后点击“删除”,同样会在未点击确认的情况下删除。预期同上。
建议不要依赖当前的删除入口直接继续执行删除逻辑,可以改成项目内已有的确认弹窗/对话框,或确保 removeGroup 只会在确认回调返回 true 后执行。请同时覆盖 GroupCard 和 Sidebar 两个入口。
English:
I tested #487 and the delete confirmation flow is still broken, so this should be fixed before merging.
Failing cases:
- Home group card: after opening the context menu and clicking Delete, the group is deleted without an explicit confirmation click. Expected: show a confirmation first, and call removeGroup only after the user explicitly confirms. Cancel/no confirmation must not delete the group.
- Sidebar group chip: right-click menu Delete has the same issue. Expected behavior is the same.
Please avoid letting the delete action fall through immediately. Prefer the app's existing confirmation dialog/modal, or otherwise ensure removeGroup is invoked only after the confirmation result is true. Please fix both GroupCard and Sidebar paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix right-click on book groups immediately deleting them on Windows instead of showing a context menu.
Closes #465
Root Cause
The group card and sidebar group components treated right-click the same as a regular click/long-press, which triggered the delete flow directly. The delete confirmation dialog appeared after the group was already removed.
Changes
packages/app/src/components/home/GroupCard.tsx: Added anonContextMenuhandler that opens a Rename/Delete context menu on right-click, preventing the default behavior and the immediate delete path.packages/app/src/components/home/HomePage.tsx: Added delete confirmation (window.confirm) before callingremoveGroup().packages/app/src/components/layout/Sidebar.tsx: Reworked sidebar group right-click to show a proper context menu with Rename and Delete options, with delete confirmation before removal.Verification
pnpm install --frozen-lockfile✅npm run build✅