Skip to content

fix(ui): prevent Enter key from submitting form in Tags component#4896

Merged
kodiakhq[bot] merged 2 commits into
v2from
markphelps/constraint-enter-key
Oct 15, 2025
Merged

fix(ui): prevent Enter key from submitting form in Tags component#4896
kodiakhq[bot] merged 2 commits into
v2from
markphelps/constraint-enter-key

Conversation

@markphelps

Copy link
Copy Markdown
Collaborator

Summary

Fixes the issue where pressing Enter in the Values textbox for "IS ONE OF" or "IS NOT ONE OF" constraints would save the entire constraint form instead of just adding the value as a tag.

Changes

  • Modified ui/src/components/forms/Tags.tsx: Restructured the inputKeyDown function to always prevent the default Enter key behavior (form submission), regardless of whether the input has a value.

The Enter key now:

  • Always prevents form submission
  • Adds a tag only when the input field has a value
  • Does nothing when the input is empty (but still prevents form submission)

Backward Compatibility

This change improves UX without breaking existing functionality. The Enter key will no longer save the constraint form when pressed in the Values input, which was the undesirable behavior reported in the issue.

Fixes #4894

Modified the Tags input component to always prevent the default
Enter key behavior (form submission), regardless of whether the
input has a value. This fixes the issue where pressing Enter in
the Values textbox for "IS ONE OF" or "IS NOT ONE OF" constraints
would save the entire form instead of just adding a tag.

The Enter key now:
- Always prevents form submission
- Adds a tag only when the input field has a value
- Does nothing when the input is empty

Fixes #4894

Signed-off-by: Mark Phelps <[email protected]>
@markphelps
markphelps requested a review from a team as a code owner October 14, 2025 22:58
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Oct 14, 2025
@dosubot

dosubot Bot commented Oct 14, 2025

Copy link
Copy Markdown

Related Documentation

Checked 4 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

@markphelps
markphelps requested a review from Copilot October 14, 2025 23:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a UX issue where pressing Enter in the Tags component's Values textbox would submit the entire constraint form instead of just adding the tag value.

  • Restructured the inputKeyDown function to always prevent Enter key's default form submission behavior
  • Maintains existing functionality where Enter adds a tag only when the input has a value
  • Improves user experience by preventing accidental form submissions

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

@codecov

codecov Bot commented Oct 14, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.01%. Comparing base (1150cec) to head (622d2d5).
⚠️ Report is 1 commits behind head on v2.

Additional details and impacted files
@@             Coverage Diff             @@
##               v2    #4896       +/-   ##
===========================================
+ Coverage   33.86%   59.01%   +25.15%     
===========================================
  Files         127      135        +8     
  Lines       16246    16874      +628     
===========================================
+ Hits         5502     9959     +4457     
+ Misses      10179     6234     -3945     
- Partials      565      681      +116     
Flag Coverage Δ
integrationtests 33.87% <ø> (+0.01%) ⬆️
unittests 49.76% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erka erka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice!

@erka erka added the v2 Flipt v2 label Oct 15, 2025
@erka erka added the automerge Used by Kodiak bot to automerge PRs label Oct 15, 2025
@kodiakhq
kodiakhq Bot merged commit bed13b0 into v2 Oct 15, 2025
46 of 48 checks passed
@kodiakhq
kodiakhq Bot deleted the markphelps/constraint-enter-key branch October 15, 2025 09:44
@github-project-automation github-project-automation Bot moved this to Done in Flipt V2 Oct 15, 2025
@dosubot

dosubot Bot commented Oct 15, 2025

Copy link
Copy Markdown

Documentation Updates

Checked 4 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

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

Labels

automerge Used by Kodiak bot to automerge PRs size:XS This PR changes 0-9 lines, ignoring generated files. v2 Flipt v2

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Pressing Enter on IS ONE OF or IS NOT ONE OF values should not save the constraint

3 participants