Skip to content

Fix to invoke InputField and TMP_InputField events#276

Merged
nowsprinting merged 6 commits intomasterfrom
fix/inputfield_events
Oct 26, 2025
Merged

Fix to invoke InputField and TMP_InputField events#276
nowsprinting merged 6 commits intomasterfrom
fix/inputfield_events

Conversation

@nowsprinting
Copy link
Copy Markdown
Owner

@nowsprinting nowsprinting commented Oct 26, 2025

Before

Set it directly to the text property.
Do not send InputField and TMP_InputField events.

After

InputField:

  • Send onSubmit and onEndEdit events after setting the text

TMP_InputField:

  • If an onValidateInput event listener exists, send the onValidateInput event
  • Send the onTouchScreenKeyboardStatusChanged event if not a standalone (PC) platform
  • Send onSubmit and onEndEdit events after setting the text

Also, the TouchScreenKeyboard is no longer opened when text entry begins.

Copilot AI review requested due to automatic review settings October 26, 2025 06:09
@github-actions github-actions bot added the bug Something isn't working label Oct 26, 2025
Copy link
Copy Markdown
Contributor

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 enhances input field operator handling to properly invoke events for both legacy InputField and TMP_InputField components. Previously, text was set directly without triggering associated events, which could cause issues with validation and event-driven UI updates.

Key Changes

  • Invokes onSubmit and onEndEdit events after text input for InputField
  • Adds onValidateInput event support with per-character validation for TMP_InputField
  • Sends onTouchScreenKeyboardStatusChanged event for TMP_InputField on non-standalone platforms
  • Removes direct OnSelect event to prevent unwanted TouchScreenKeyboard display

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Runtime/Operators/UguiTextInputOperator.cs Enhanced text input operator to invoke input field events properly
Tests/Runtime/Operators/UguiTextInputOperatorTest.cs Updated test names for clarity and added validation test
Annotations/InputFieldAnnotation.cs Updated documentation to include TMP_InputField
Samples~/uGUI Demo/Scripts/Runtime/EventHandlers/SpyInputFieldEventReceiver.cs New event receiver for testing input field events
Samples~/uGUI Demo/Scripts/Runtime/EventHandlers/AbstractSpyEventHandler.cs Added support for InputField and keyboard events
Samples~/uGUI Demo/Scenes/uGUIDemo.unity Added UI components for TMP_InputField testing
Samples~/uGUI Demo/Tests/Runtime/TextInputOperatorTest.cs Split test into separate tests for Legacy and TMP inputs
Samples~/uGUI Demo/Scripts/Runtime/TestHelper.UI.Samples.UguiDemo.asmdef Added Unity.TextMeshPro reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@nowsprinting nowsprinting force-pushed the fix/inputfield_events branch from 45d4077 to 3ba2d46 Compare October 26, 2025 19:23
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@nowsprinting nowsprinting force-pushed the fix/inputfield_events branch from 12ddd31 to ea17aab Compare October 26, 2025 20:29
@github-actions

This comment has been minimized.

@nowsprinting nowsprinting force-pushed the fix/inputfield_events branch from ea17aab to 6f43a07 Compare October 26, 2025 20:48
@github-actions
Copy link
Copy Markdown

Code Metrics Report

master (dd60ab6) #276 (6f086aa) +/-
Coverage 89.2% 88.7% -0.5%
Code to Test Ratio 1:1.3 1:1.3 -0.1
Test Execution Time 11m50s 10m38s -1m12s
Details
  |                     | master (dd60ab6) | #276 (6f086aa) |  +/-   |
  |---------------------|------------------|----------------|--------|
- | Coverage            |            89.2% |          88.7% |  -0.5% |
  |   Files             |               69 |             70 |     +1 |
  |   Lines             |             2393 |           2512 |   +119 |
+ |   Covered           |             2135 |           2230 |    +95 |
- | Code to Test Ratio  |            1:1.3 |          1:1.3 |   -0.1 |
  |   Code              |             4371 |           4521 |   +150 |
+ |   Test              |             6077 |           6098 |    +21 |
+ | Test Execution Time |           11m50s |         10m38s | -1m12s |

Code coverage of files in pull request scope (87.7% → 84.2%)

Files Coverage +/- Status
/github/workspace/UnityProject~/Assets/Samples/uGUI Demo/Scripts/Runtime/EventHandlers/AbstractSpyEventHandler.cs 70.8% -1.4% affected
/github/workspace/UnityProject~/Assets/Samples/uGUI Demo/Scripts/Runtime/EventHandlers/SpyInputFieldEventReceiver.cs 78.8% +78.8% affected
/github/workspace/UnityProject~/Assets/Samples/uGUI Demo/Scripts/Runtime/GameObjectFinderButton.cs 93.1% -0.5% affected
Annotations/InputFieldAnnotation.cs 100.0% 0.0% modified
Runtime/Operators/UguiTextInputOperator.cs 100.0% 0.0% modified

Reported by octocov

@nowsprinting nowsprinting merged commit b13464f into master Oct 26, 2025
14 checks passed
@nowsprinting nowsprinting deleted the fix/inputfield_events branch October 26, 2025 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants