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

bug: ion-range emit value 'NaN' when dragging to the far left end of the screen when the browser is full screen #29792

Closed
3 tasks done
dodo-Riley opened this issue Aug 23, 2024 · 1 comment · Fixed by #29820 · May be fixed by l00pinfinity/devvscape-code-humor#71
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@dodo-Riley
Copy link

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Peek 2024-08-23 14-31.webm
Please refer to the attached video.

In event handlers such as ionInput or ionKnobMoveEnd on an ion-range, it can happen that the event.detail.value is NaN.
When specifying currentX in the onEnd function inside range.js, detail.currentX can be 0.
But, If it is 0, it tries to assign clientX to currentX by || even though it is a GestureDetail. However, in this case, clientX is undefined, which causes a NaN to occur later.

The problematic part of the code is attached as the image below.
image (18)
The bug can be fixed if it is modified to pass 0 when detail.currentX is 0.

Expected Behavior

When detail.currentX is 0, the value should be passed as is.

Steps to Reproduce

  1. clone reproduction code.
  2. start project
  3. set browser to full screen
  4. drag knob to the far left end of the screen

Code Reproduction URL

https://github.com/dodo-Riley/ionic-range-test

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (/home/toonsquare/.nvm/versions/node/v18.18.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.8.6
@angular-devkit/build-angular : 15.2.11
@angular-devkit/schematics : 15.2.11
@angular/cli : 15.2.11
@ionic/angular-toolkit : 11.0.1

Utility:

cordova-res : 0.15.4
native-run (update available: 2.0.1) : 2.0.0

System:

NodeJS : v18.18.1 (/home/toonsquare/.nvm/versions/node/v18.18.1/bin/node)
npm : 9.8.1
OS : Linux 6.5

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Aug 23, 2024
@sean-perkins sean-perkins added package: core @ionic/core package type: bug a confirmed bug report labels Aug 30, 2024
@ionitron-bot ionitron-bot bot removed the triage label Aug 30, 2024
github-merge-queue bot pushed a commit that referenced this issue Aug 30, 2024
Issue number: resolves #29792

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When the user drags the range knob (most easily reproduced in fullscreen
mode) and the gesture emits a current x position of `0`, the range
incorrectly emits a value of `NaN`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- `ion-range` does not emit `NaN` and instead emits the correct range
value for the knob

## Does this introduce a breaking change?

- [ ] Yes
- [ ] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
Copy link

ionitron-bot bot commented Sep 29, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
2 participants