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

feat(range): add knobMoveStart and knobMoveEnd events #25011

Merged
merged 14 commits into from
Apr 1, 2022

Conversation

amandaejohnston
Copy link
Contributor

@amandaejohnston amandaejohnston commented Mar 28, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The only way to listen for user interaction with an ion-range is the ionChange event. This doesn't fit all use cases, as it fires many times throughout a single drag gesture (every time the range's value updates). If a dev wants to listen for the user's gesture to finish, debouncing an ionChange listener wouldn't work either, as it would delay the drag-end handler by the debounce time.

Issue URL: Resolves #17839

What is the new behavior?

Adds two new events: ionKnobMoveStart and ionKnobMoveEnd. These fire at, respectively, the start and end of a touch gesture or mouse drag on the range. Both events include the range's value at the time. Keyboard interaction is also handled.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@amandaejohnston amandaejohnston requested a review from a team as a code owner March 28, 2022 19:48
@github-actions github-actions bot added package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package labels Mar 28, 2022
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

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

I am also indifferent to the event names. I do not think they are immediately recognizable as to what they are used for, but also cannot think of an alternative name that is more clear than ionChangeStart and ionChangeEnd.

core/src/components/range/range-interface.ts Outdated Show resolved Hide resolved
core/src/components/range/range.tsx Outdated Show resolved Hide resolved
core/src/components/range/test/basic/e2e.ts Show resolved Hide resolved
core/src/components/range/range.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

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

Looks good to me, great work on this 🎉

core/src/components/range/range-interface.ts Outdated Show resolved Hide resolved
core/src/components/range/range.tsx Outdated Show resolved Hide resolved
core/src/components/range/range-interface.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Do we need to call ensureValueInBounds when emitting the events?

value = this.ensureValueInBounds(value);
this.ionChange.emit({ value });

I don't know if the valueChanged callback will update the value prop with the clamped values.

Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Great job! Don't forget to update the commit subject line to reflect the new event names.

@amandaejohnston
Copy link
Contributor Author

Good catch, thanks!

@amandaejohnston amandaejohnston changed the title feat(range): add changeStart and changeEnd events feat(range): add knobMoveStart and knobMoveEnd events Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants