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): emit ionInput when value changes #30293

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

fix(range): emit ionInput when value changes #30293

wants to merge 5 commits into from

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented Mar 21, 2025

Issue number: resolves #29619


What is the current behavior?

The ionInput emits for range even when the value hasn't changed. This does not match our documentation. It should only emit when the value changes (and continuously while the user is dragging the knob).

What is the new behavior?

  • Moved the emitter to the value watch function, to determine if the value has changed.
  • Added a test

Does this introduce a breaking change?

  • Yes
  • No

Other information

How to test:

  1. Navigate to the range basic HTML file
  2. Add the following script
const ionicRanges = document.querySelectorAll('ion-range');

ionicRanges.forEach(range => {  
  range.addEventListener('ionInput', function(ev) {
    console.log('ionInput', ev.currentTarget.value);
  });
});
  1. Navigate to the range test page
  2. Open the console
  3. Move the single knob range (let go when you're done)
  4. Verify that the value is shown in the console
  5. Tap as close to the middle of the knob. The goal is to tap it without the value moving.
  6. Verify that the value does not show in the console

Copy link

vercel bot commented Mar 21, 2025

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 24, 2025 8:55pm

@thetaPC thetaPC marked this pull request as ready for review March 21, 2025 20:18
@thetaPC thetaPC requested a review from a team as a code owner March 21, 2025 20:18
@thetaPC thetaPC requested review from christian-bromann, ShaneK and brandyscarney and removed request for christian-bromann March 21, 2025 20:18
Copy link
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Generally looks good, I left one comment but it's probably just a nit. Nice work 🚀

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.

Non-blocking suggestion but otherwise looks good! 🎉

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: range ionInput event behavior inconsistent with documentation
3 participants