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

Disable Enter key until input contains text #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ADISHA2003
Copy link

Description

This pull request enhances the usability of the input field in the side panel with the following changes:

  1. Prevent Empty Submissions:

    • The Enter key now triggers a submission only if the input contains text (non-whitespace characters).
    • This avoids accidental empty submissions and improves user experience.
  2. Disable Send Button:

    • The Send button is disabled until the input field contains valid text.
    • This provides a visual indicator to users and reinforces the restriction on empty submissions.
  3. Code Improvements:

    • Improved code readability with updated comments and formatting.
    • Refactored onKeyDown and handleSubmit to ensure consistent behavior when submitting.
  4. Testing and Validation:

    • All changes have been tested locally to confirm proper functionality and avoid regressions.

Impact

  • Improves user experience by preventing unnecessary empty submissions.
  • Offers clear feedback to users through a disabled Send button when input is invalid or empty.

Preview of Changes

  • Files Modified:

    • .env (minor formatting adjustments, no functional changes).
    • src/components/side-panel/SidePanel.tsx (core updates).
  • Key Changes:

    • Added input validation in handleKeyDown and handleSubmit to check for non-empty text.
    • Updated disabled state of the Send button based on trimmed input content.

Testing and Verification

  • Tested locally to ensure:
    • The Send button is disabled when input is empty or whitespace-only.
    • The Enter key does not trigger submission for invalid input.
    • Existing functionality remains unaffected.

Request to Reviewers

Please review the changes to ensure consistency with project standards. Feedback or suggestions for improvement are greatly appreciated!

Copy link

google-cla bot commented Dec 24, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant