Skip to content

Conversation

@1307-Dev
Copy link
Collaborator

💡 What is the current behavior?

Render an ix-input with the required attribute.
Ensure the input starts empty (invalid).
Type any non-empty text into the input.
Blur - Let the event fire

The input becomes valid.
validityStateChange is not emitted when the input first becomes valid.

GitHub Issue Number: #2315
JIRA Issue- IX-3807

🆕 What is the new behavior?

validityStateChange should fire when the input transitions from invalid to valid.
The emitted event should contain:
valid === true

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

👨‍💻 Help & support

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2026

🦋 Changeset detected

Latest commit: 089df6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@siemens/ix Patch
@siemens/ix-angular Patch
@siemens/ix-docs Patch
@siemens/ix-react Patch
@siemens/ix-vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @1307-Dev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug where input components failed to correctly emit the validityStateChange event when their state transitioned from invalid to valid. The changes ensure that all relevant input components (DateInput, TimeInput, Input, NumberInput, Textarea) accurately report their validity status, providing reliable feedback for form validation and user experience. This fix enhances the robustness of form controls by ensuring that validity state changes are consistently communicated throughout the application lifecycle.

Highlights

  • Fix for validityStateChange event emission: Resolved an issue where the validityStateChange event was not emitted when an input component transitioned from an invalid to a valid state, particularly after user interaction like typing and blurring.
  • Enhanced Validity State Tracking: Introduced new internal properties (lastEmittedPatternMismatch, lastEmittedValueMissing) in DateInput and TimeInput components to accurately track and prevent redundant validityStateChange emissions, ensuring the event fires only when the actual validity state changes.
  • Improved Internal Validity Checks: Integrated checkInternalValidity calls into the updateFormInternalValue method for Input, NumberInput, and Textarea components. This ensures that the validity state is re-evaluated and updated whenever the component's value changes, provided the component has been 'touched'.
  • Extended Validity State Types: Updated DateInputValidityState and TimeInputValidityState types to include valueMissing: boolean, providing a more comprehensive representation of the input's validity status.
  • Refined CSS Class Toggling for Invalid State: Modified the HookValidationLifecycle utility to toggle the ix-invalid--validity-invalid CSS class based on the overall validity state (!validityState.valid) and whether the input has been 'touched', improving visual feedback for invalid, user-interacted fields.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix to ensure the validityStateChange event is correctly emitted across all input components when their validity state changes. For standard inputs, this is achieved by triggering validation checks on programmatic value updates. For custom inputs like date-input and time-input, a more robust mechanism has been implemented to track the last emitted validity state, preventing duplicate events and ensuring correctness. The changes are well-implemented and address the core issue. I've identified one minor inconsistency in the date-input component that could lead to stale form values, for which I've provided a suggestion.

@1307-Dev 1307-Dev changed the title Added fix for all input components. fix(core/input): Added fix for validitystatechange event not working on input components. (input, number input, date, time and textarea) Jan 13, 2026
@1307-Dev 1307-Dev marked this pull request as ready for review January 15, 2026 08:29
1307-Dev and others added 2 commits January 15, 2026 15:18
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Collaborator

@nuke-ellington nuke-ellington left a comment

Choose a reason for hiding this comment

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

Check Sonarqube

@1307-Dev
Copy link
Collaborator Author

@nuke-ellington The code line duplication in date input and time input can't be reduced further. All utils have been extracted. The code block duplication has existed before this PR.

@nuke-ellington nuke-ellington added this to the 4.4.0 milestone Feb 4, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
3.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

4 participants