Skip to content

fix: keyboard opening unexpectedly#3278

Merged
Dhruwang merged 4 commits intoformbricks:mainfrom
devcodes9:fix/3239-keyboard-mobile
Oct 4, 2024
Merged

fix: keyboard opening unexpectedly#3278
Dhruwang merged 4 commits intoformbricks:mainfrom
devcodes9:fix/3239-keyboard-mobile

Conversation

@devcodes9
Copy link
Copy Markdown
Contributor

@devcodes9 devcodes9 commented Oct 3, 2024

What does this PR do?

This PR fixes the issue where the mobile keyboard opens unexpectedly for rating questions in surveys, even when no text input is required.

Fixes #3239

Record_2024-10-04-00-01-54.mp4

How should this be tested?

  • Test A:
    • Add an Open Text question to a form.
    • Navigate through the form and observe the behavior of the two steps preceding the Open Text question.
    • Ensure that the keyboard does not appear upon submitting the question prior to the Open Text question.
    • Verify that the keyboard appears only when the Open Text question is reached.

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Summary by CodeRabbit

  • New Features

    • Improved focus logic for the Open Text Question component, ensuring the input field is focused only when the corresponding question is displayed.
  • Bug Fixes

    • Enhanced the callback function to prevent focus issues when navigating between questions.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 3, 2024

@devcodes9 is attempting to deploy a commit to the formbricks Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added bug Something isn't working 🕹️ 50 points 🕹️ oss.gg Community issue via oss.gg labels Oct 3, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 3, 2024

Thank you for following the naming conventions for pull request titles! 🙏

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 3, 2024

Walkthrough

The changes in the OpenTextQuestion.tsx file enhance the focus logic of the OpenTextQuestion component. An additional condition is added to the openTextRef callback function to ensure that the input field is only focused when the question.id matches the currentQuestionId. The dependency array for the useCallback hook is also updated to include currentQuestionId, aligning the focus behavior with the currently displayed question.

Changes

File Path Change Summary
packages/surveys/src/components/questions/OpenTextQuestion.tsx Updated openTextRef to include a condition for currentQuestionId and modified useCallback dependencies.

Assessment against linked issues

Objective Addressed Explanation
Keyboard should only appear when user needs to enter text (Issue #3239)

Suggested labels

bug

Suggested reviewers

  • gupta-piyush19

Poem

Hop, hop, hooray, it's a brand new day,
Focus on questions, come out and play!
With logic so bright, and a tweak here and there,
The keyboard won't pop up, it’s a breath of fresh air!
So let’s bounce along, with joy in our hearts,
For every small change, a masterpiece starts! 🐇✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@devcodes9 devcodes9 changed the title Fix/3239 keyboard mobile fix: keyboard opening unexpectedly Oct 3, 2024
@jobenjada jobenjada requested a review from Dhruwang October 3, 2024 21:31
Copy link
Copy Markdown
Member

@Dhruwang Dhruwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @devcodes9 thanks for the fix, works well 🚀✅💪

@Dhruwang Dhruwang enabled auto-merge October 4, 2024 05:28
@Dhruwang Dhruwang added this pull request to the merge queue Oct 4, 2024
Merged via the queue into formbricks:main with commit f38a466 Oct 4, 2024
@oss-gg
Copy link
Copy Markdown

oss-gg Bot commented Oct 4, 2024

Awarding devcodes9: 50 points 🕹️ Well done! Check out your new contribution on oss.gg/devcodes9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working 🕹️ oss.gg Community issue via oss.gg 🕹️ 50 points

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Keyboard Unexpectedly Opening on Mobile Devices

2 participants