Skip to content

fix(gcds-input): stepMismatch errors with decimal numbers#1271

Open
ethanWallace wants to merge 2 commits into
mainfrom
fix/input-stepMismatch-error
Open

fix(gcds-input): stepMismatch errors with decimal numbers#1271
ethanWallace wants to merge 2 commits into
mainfrom
fix/input-stepMismatch-error

Conversation

@ethanWallace
Copy link
Copy Markdown
Collaborator

@ethanWallace ethanWallace commented May 22, 2026

📝 Summary | Résumé

As mentioned in #1267, when assigning a min with a decimal value like 1.5, entering a number of 2 would produce a stepMismatch error without proper numbers (NaN). This was caused by the step not being defined when creating the stepMismatch error so the error message would produce two NaNs. Logic has also been added to present the appropriate number when expecting decimal numbers as valid values.

🧩 Related Issues | Cartes liées

🧪 Test instructions | Instructions pour tester la modification

TODO: Replace the instructions below as needed. Describe any steps needed to verify the change(s) work as expected.

  1. Check the current behaviour
  • Checkout the main branch
  • Open the index.html test file
  • Add the following test code inside the <body>:
         <gcds-input
          label="Number"
          type="number"
          input-id="number"
          min="1.5"
        ></gcds-input>
  • Confirm the following behaviour:
    • Enter 1 into the input and remove focus.
    • Observe you get the min error message.
    • Enter 4 into the input and remove focus
    • Observe the stepMismatch error returns with NaN in place of the expected lower and higher values
  1. Validate the change
  • Checkout this branch
  • Open the index.html test file
  • Use the exact same test code as above
  • Confirm the following behaviour:
    • Enter 1 into the input and remove focus.
    • Observe you get the min error message.
    • Enter 4 into the input and remove focus
    • Observe the stepMismatch error returns with 3.5 and 4.5 as the lower and higher acceptable values

✍️ Author checklist | Liste de vérification de l'auteur

Choose one:

  • This PR is a patch (use fix:)
  • This PR introduces a minor change (use feat:)
  • This PR introduces breaking changes to the API (use feat!:)
  • This PR does not introduce changes that need to be published on NPM (use chore:, docs:, ci:)

Breaking changes flag:

  • This PR does not break existing functionality. I have completely tested the functionality of these changes.
  • This PR does not introduce any changes to component names, properties, values, or behaviour.
  • If this PR introduces API or behaviour changes, backwards compatibility has been implemented and documented under Impact and Risks.
  • If this PR introduces a breaking change, release notes and versioning have been prepared.

Ready for review: (all items must be checked)

  • I have tested the English and French versions of the changes, and can verify that all content is accurate and properly displayed in both languages.
  • I have tested these changes on mobile viewports.
  • I have tested these changes across multiple supported browsers.
  • I have checked accessiblity and ensured all accessiblity tests pass.
  • I have added tests for added functionality or changed existing tests, as needed.
  • I have added or updated documentation, if needed.
  • For visual or design-affecting changes, I have posted in dev-design slack channel.
  • Visual or content changes remain aligned with design tokens and component API standards.
  • Test instructions are clear and reproducible.

🧐 Reviewer checklist | Liste de vérification du réviseur

Developer checklist

For PRs that are complex, in lieu of a simple approval or an "LGTM" ✅, paste the following info with your approval:

  • I have tested the changes and functionality using the test instructions.
  • I have confirmed test coverage is adequate.
  • I have reviewed the code for clarity, maintainability and potential issues.

@ethanWallace ethanWallace requested a review from a team as a code owner May 22, 2026 13:50
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