Skip to content

Updated Readonly date and timeinput #2409

Open
varun-srinivasa wants to merge 2 commits intomainfrom
fix-1309/ix-input
Open

Updated Readonly date and timeinput #2409
varun-srinivasa wants to merge 2 commits intomainfrom
fix-1309/ix-input

Conversation

@varun-srinivasa
Copy link
Collaborator

@varun-srinivasa varun-srinivasa commented Feb 24, 2026

💡 What is the current behavior?

When working with read-only forms, I noticed something unexpected happens during validation. If there is an error in any input value, the expected behavior is that the input remains non-interactive however when the error appears the input becomes selectable/interactive. only in date and time input

GitHub Issue Number: IX-3909

🆕 What is the new behavior?

Now even in readonly form the date and time input components are not interactive

🏁 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 Feb 24, 2026

⚠️ No Changeset found

Latest commit: 3222771

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @varun-srinivasa, 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 an inconsistency in the behavior of ix-date-input and ix-time-input components when they are set to readonly. Previously, these inputs could still trigger their dropdowns on focus, even when read-only, which was not the intended user experience, particularly in forms with validation errors. The changes ensure that these components now correctly respect their readonly and disabled states, preventing any interactive elements from appearing.

Highlights

  • Read-only input behavior: Corrected an issue where ix-date-input and ix-time-input components, when in a readonly state, would unexpectedly become interactive and allow dropdowns to open upon focus, especially after validation errors.
  • Conditional dropdown interaction: Implemented conditional logic to prevent the date and time dropdowns from opening when the respective input fields are marked as readonly or disabled, ensuring consistent non-interactive behavior.
Changelog
  • packages/core/src/components/date-input/date-input.tsx
    • Prevented the dropdown from opening on focus when the input is readonly or disabled.
    • Made the dropdown trigger conditional on the input not being readonly or disabled.
  • packages/core/src/components/time-input/time-input.tsx
    • Prevented the dropdown from opening on focus when the input is readonly or disabled.
    • Made the dropdown trigger conditional on the input not being readonly or disabled.
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 addresses an issue where readonly date and time inputs become interactive when a validation error is displayed. The changes prevent the dropdown from opening on focus and remove the dropdown trigger when the component is in a readonly or disabled state. The implementation is correct and effectively solves the problem. I've added a couple of suggestions to improve code maintainability by encapsulating the repeated condition into a getter.

Comment on lines +434 to +436
if (!this.readonly && !this.disabled) {
this.openDropdown();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The condition !this.readonly && !this.disabled is now used in two places in this file. To improve code clarity and maintainability, you could introduce a private getter for this logic.

For example:

private get isInteractive() {
  return !this.readonly && !this.disabled;
}

You could then use this.isInteractive here and for the trigger prop of the ix-dropdown component (lines 555-557). This would make the code more readable and easier to maintain if the logic for determining interactivity changes in the future.

Comment on lines +450 to +452
if (!this.readonly && !this.disabled) {
this.openDropdown();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the date-input component, the condition !this.readonly && !this.disabled is used twice here. To avoid duplication and improve readability, consider extracting this logic into a private getter.

For example:

private get isInteractive() {
  return !this.readonly && !this.disabled;
}

This getter can then be used here and for the trigger prop of the ix-dropdown component (lines 569-571).

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@varun-srinivasa varun-srinivasa marked this pull request as ready for review March 2, 2026 05:02
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