fix: issue of triggering opening and closing question paper on clicking on submenu options#3506
Conversation
…licking on submenu options
|
@SharadK10 is attempting to deploy a commit to the formbricks Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions for pull request titles! 🙏 |
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditorCardMenu.tsx (1)
212-214: LGTM: Prevents unintended question editor toggling for "Add question below".This change effectively addresses the issue described in #3485 for the "Add question below" submenu, similar to the previous change. It prevents the default action, stopping the propagation of the click event.
Consider extracting the
onClickhandler to a reusable function to improve code maintainability, as it's identical for both submenu triggers. For example:const preventDefaultClick = (e: React.MouseEvent) => e.preventDefault(); // Then use it in both DropdownMenuSubTrigger components: <DropdownMenuSubTrigger className="cursor-pointer text-sm text-slate-600 hover:text-slate-700" onClick={preventDefaultClick}> // ... content ... </DropdownMenuSubTrigger>This refactoring would reduce code duplication and make future updates easier.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditorCardMenu.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (2)
apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditorCardMenu.tsx (2)
169-171: LGTM: Prevents unintended question editor toggling.This change effectively addresses the issue described in #3485 by preventing the default action when clicking on the "Change question type" submenu. It stops the propagation of the click event, which should resolve the unintended opening and closing of the question editor.
Line range hint
1-280: Summary: PR successfully addresses the issue and meets objectives.This PR effectively resolves the issue described in #3485 by preventing the default action on submenu clicks. The implementation is correct and aligned with the project's goals. The changes successfully stop the unintended opening and closing of the question editor when interacting with submenu options.
A minor suggestion for code improvement has been made to enhance maintainability. Overall, this PR is ready to be merged after addressing the refactoring suggestion if deemed necessary.
mattinannt
left a comment
There was a problem hiding this comment.
@SharadK10 thank you for the fix 🎉💪
|
Awarding SharadK10: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/SharadK10 |
Thanks @mattinannt for reviewing and merging my request looking forward make many more contributions to the community.😊 |
…ng on submenu options (formbricks#3506) Co-authored-by: Matti Nannt <[email protected]>
What does this PR do?
Disabled the onClick option for the submenu options so that the question paper is not triggered when clicking on the options.
Fixes #3485
REC-20241012062552.mp4
Summary by CodeRabbit
New Features
Bug Fixes