Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 14, 2025

  • Explore repository structure and understand the issue
  • Identify affected components: SupaEmailAuth, SupaPhoneAuth, SupaMagicAuth, SupaResetPassword
  • Add enableAutomaticFormSubmission flag to SupaEmailAuth constructor
  • Update SupaEmailAuth password field to conditionally submit on Enter
  • Update SupaEmailAuth email field (password recovery) to conditionally submit on Enter
  • Update SupaEmailAuth metadata fields to conditionally submit on Enter
  • Add enableAutomaticFormSubmission flag to SupaPhoneAuth constructor
  • Update SupaPhoneAuth password field to conditionally submit on Enter
  • Add enableAutomaticFormSubmission flag to SupaMagicAuth constructor
  • Update SupaMagicAuth email field to conditionally submit on Enter
  • Add enableAutomaticFormSubmission flag to SupaResetPassword constructor
  • Update SupaResetPassword password field to conditionally submit on Enter
  • Verify the changes work correctly (run analyzer and format check)
  • Apply dart format to the code
  • Create comprehensive documentation for the new feature
  • Update CHANGELOG.md with the new feature
  • Apply final formatting and verify all code passes analysis
  • Refactor duplicated code in SupaMagicAuth, SupaPhoneAuth, and SupaResetPassword into separate methods
  • Fix all analyzer warnings (use_build_context_synchronously, sort_child_properties_last)
Original prompt

This section details on the original issue you should resolve

<issue_title>Add flag to prevent automatic submission of form when using on-screen keyboard</issue_title>
<issue_description>When the authentication form is used in a mobile app, an on-screen keyboard (correctly) appears when the user edits a field.
However, a problem arises when the user edits the password via the on-screen keyboard: by pressing the Enter button on the on-screen keyboard, the form is automatically submitted.
Add a configuration flag in all the relevant constructors so that this default behaviour can be disabled. In some cases, we want the user to be forced to explicitly click on the submit button to proceed with the authentication process.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 4 commits October 14, 2025 13:39
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Add flag to prevent automatic submission of form with on-screen keyboard Add enableAutomaticFormSubmission flag to prevent automatic form submission on Enter key Oct 14, 2025
@Copilot Copilot AI requested a review from maurovanetti October 14, 2025 13:48
Copilot finished work on behalf of maurovanetti October 14, 2025 13:48
Copy link
Owner

@maurovanetti maurovanetti left a comment

Choose a reason for hiding this comment

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

@copilot In _SupaMagicAuthState, _SupaPhoneAuthState, and _SupaResetPasswordState, you have copied and pasted a long piece of code that corresponds to the submit callback of the submit button. Refactor these code blocks into a distinct method and call it from both the places where it could be called (last field + submit button).

- Extract _signInWithMagicLink() method in SupaMagicAuth
- Extract _submitForm() method in SupaPhoneAuth
- Extract _updatePassword() method in SupaResetPassword
- Fix use_build_context_synchronously warnings by properly checking context.mounted
- Fix sort_child_properties_last warnings by placing child parameter last
- Reduces code duplication and improves maintainability

Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Copy link
Author

Copilot AI commented Oct 14, 2025

@copilot In _SupaMagicAuthState, _SupaPhoneAuthState, and _SupaResetPasswordState, you have copied and pasted a long piece of code that corresponds to the submit callback of the submit button. ...

Refactored the duplicated form submission logic into dedicated methods:

  • _signInWithMagicLink() in SupaMagicAuth
  • _submitForm() in SupaPhoneAuth
  • _updatePassword() in SupaResetPassword

This eliminated ~95 lines of duplicated code and fixed all analyzer warnings. Commit: 2c7d1a7

@Copilot Copilot AI requested a review from maurovanetti October 14, 2025 14:13
Copilot finished work on behalf of maurovanetti October 14, 2025 14:13
@maurovanetti maurovanetti marked this pull request as ready for review October 14, 2025 15:27
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 15:27
@maurovanetti maurovanetti merged commit 550e270 into main Oct 14, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an enableAutomaticFormSubmission flag to all authentication components to control whether pressing Enter on the on-screen keyboard automatically submits forms. This addresses mobile UX issues where users might accidentally submit forms when using on-screen keyboards.

  • Added enableAutomaticFormSubmission parameter to all auth components (defaults to true for backward compatibility)
  • Refactored inline form submission logic into separate methods for better maintainability
  • Updated documentation and changelog to reflect the new feature

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/src/components/supa_email_auth.dart Added flag and conditional form submission logic for email authentication
lib/src/components/supa_phone_auth.dart Added flag and refactored form submission into separate method
lib/src/components/supa_magic_auth.dart Added flag and extracted magic link submission logic
lib/src/components/supa_reset_password.dart Added flag and separated password update logic
lib/src/components/supa_socials_auth.dart Code formatting improvements
lib/src/components/supa_verify_phone.dart Code formatting improvements
lib/src/utils/constants.dart Code formatting improvements
README.md Added comprehensive documentation for the new feature
CHANGELOG.md Added entry for the new feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

Add flag to prevent automatic submission of form when using on-screen keyboard

2 participants