-
-
Notifications
You must be signed in to change notification settings - Fork 5
Clean up semantic-domain-clicking behavior #2124
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
Conversation
📝 WalkthroughWalkthroughRefactors back-to-list button interaction patterns across multiple dictionary display components. The BackToListButton callback signature simplifies to accept no arguments with the dictionaryEntry prop removed. DictionaryEntryDisplay adds semantic domain click handling, DictionaryList updates its callback behavior, and DomainsDisplay adds event propagation guards. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
platform.bible-extension/src/components/domains-display.tsx (1)
41-46: LGTM with a minor observation.The addition of
e.stopPropagation()correctly prevents the click from bubbling to parent handlers. However, the explicitif (onClickDomain)check on line 42 is redundant since the button is alreadydisabled={!onClickDomain}on line 39, preventing clicks when the handler is undefined.Optional simplification:
- onClick={(e) => { - if (onClickDomain) { - e.stopPropagation(); - onClickDomain(domain); - } - }} + onClick={(e) => { + e.stopPropagation(); + onClickDomain?.(domain); + }}
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
platform.bible-extension/src/components/back-to-list-button.tsx(2 hunks)platform.bible-extension/src/components/dictionary-entry-display.tsx(4 hunks)platform.bible-extension/src/components/dictionary-list.tsx(3 hunks)platform.bible-extension/src/components/domains-display.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: imnasnainaec
Repo: sillsdev/languageforge-lexbox PR: 1867
File: platform.bible-extension/src/main.ts:239-246
Timestamp: 2025-07-31T19:10:41.178Z
Learning: In the sillsdev/languageforge-lexbox repository, user imnasnainaec prefers to defer code improvements when there are related TODO comments indicating planned refactoring work, choosing to bundle related changes together rather than making incremental improvements that would need to be modified again during the larger refactoring.
📚 Learning: 2025-07-31T16:00:49.635Z
Learnt from: imnasnainaec
Repo: sillsdev/languageforge-lexbox PR: 1867
File: platform.bible-extension/src/types/fw-lite-extension.d.ts:4-22
Timestamp: 2025-07-31T16:00:49.635Z
Learning: In the sillsdev/languageforge-lexbox repository, the platform.bible-extension is intentionally tightly coupled with the frontend's dotnet-types. The relative imports from `../../../frontend/viewer/src/lib/dotnet-types/index.js` in the extension's type declarations are by design, not a maintainability issue that needs to be addressed.
Applied to files:
platform.bible-extension/src/components/dictionary-entry-display.tsxplatform.bible-extension/src/components/back-to-list-button.tsx
📚 Learning: 2025-12-05T10:28:57.551Z
Learnt from: CR
Repo: sillsdev/languageforge-lexbox PR: 0
File: frontend/viewer/AGENTS.md:0-0
Timestamp: 2025-12-05T10:28:57.551Z
Learning: Applies to frontend/viewer/**/*.{svelte,ts,tsx,js,jsx} : Use Lingui with svelte-i18n-lingui for internationalization (i18n)
Applied to files:
platform.bible-extension/src/components/dictionary-entry-display.tsx
🧬 Code graph analysis (1)
platform.bible-extension/src/components/dictionary-entry-display.tsx (1)
platform.bible-extension/src/types/fw-lite-extension.d.ts (1)
ISemanticDomain(14-14)
🔇 Additional comments (7)
platform.bible-extension/src/components/dictionary-list.tsx (2)
56-58: LGTM!The new
clearSelectedEntryhelper provides clearer semantics for the back-to-list action. Previously,handleOptionSelecttoggled the selection state, which was less intuitive. The explicit clear operation better matches user expectations when returning to the list.
130-130: LGTM!Consistently using
clearSelectedEntryfor the back-to-list behavior in both wide-screen and drawer modes ensures predictable UX.Also applies to: 151-151
platform.bible-extension/src/components/back-to-list-button.tsx (2)
10-10: LGTM!Simplifying the callback signature to
() => voidis appropriate since the back-to-list action doesn't need dictionary entry data. This reduces coupling between components.
32-42: LGTM!The conditional
DrawerClosewrapper cleanly handles the drawer-specific close behavior, while the simplifiedonClickhandler reflects the streamlined callback signature.platform.bible-extension/src/components/dictionary-entry-display.tsx (3)
52-60: LGTM!The
onClickDomainwrapper elegantly coordinates semantic domain clicks with drawer closure. When a user clicks a domain in drawer mode, they get both the domain navigation and a smooth return to the list view.
25-25: LGTM!The prop signature changes align well with the overall refactoring:
- Simplified
handleBackToListButtoncallback removes unnecessary coupling- New
onClickSemanticDomainprop enables the domain-click coordination patternAlso applies to: 29-29
115-115: LGTM!Passing the
onClickDomainwrapper (instead ofonClickSemanticDomaindirectly) ensures that domain clicks properly trigger drawer closure in drawer mode.
This pr fixes two subpar behaviors in the find-related-words WebView.
e.stopPropagation().