Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(range): handle unsupported values for range min, max, and step #30070

Merged
merged 9 commits into from
Mar 7, 2025

Conversation

fudom
Copy link
Contributor

@fudom fudom commented Dec 10, 2024

Issue number: resolves #29667


What is the current behavior?

Currently, if min/max are set to undefined on IonRange (which is an accepted value), it breaks the DOM.

What is the new behavior?

After these changes, if min/max are set to undefined or any unsupported value (such as infinity or a NaN), it will fall back to the default values for min and max (currently, 1 and 100 respectively).

Does this introduce a breaking change?

  • Yes
  • No

Other information

@fudom fudom requested a review from a team as a code owner December 10, 2024 11:51
@fudom fudom requested a review from rugoncalves December 10, 2024 11:51
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2025 10:11pm

Copy link

Choose a reason for hiding this comment

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

Can SafeNumber be defined by a fixed value or a fixed range of values,

For example,

0 and <0.00005
any input is number between 0 and 0.00005 to be defined and therefore handled as a "nullish value" and enable the rule to be applied if (!isSafeNumber(n)) return 0;

@ShaneK ShaneK changed the title fix(range) Handle nullish values fix(range): handle nullish values Mar 6, 2025
…min were set to undefined by setting max and min to their default values if you try to set them directly to undefined
@ShaneK ShaneK changed the title fix(range): handle nullish values fix(range): handle unsupported values for range min and max Mar 7, 2025
Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM

@thetaPC
Copy link
Contributor

thetaPC commented Mar 7, 2025

@fudom Congrats on your first PR with Ionic!

Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

Looks great 🙂

@ShaneK ShaneK added this pull request to the merge queue Mar 7, 2025
@ShaneK ShaneK changed the title fix(range): handle unsupported values for range min and max fix(range): handle unsupported values for range min, max, and step Mar 7, 2025
Merged via the queue into ionic-team:main with commit 3223193 Mar 7, 2025
49 checks passed
@ShaneK
Copy link
Member

ShaneK commented Mar 7, 2025

Thank you for your PR! It was merged into main and will go out with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: ion-range throws: Cannot read properties of undefined.
5 participants