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(slider): value-changed event is not fired #174

Merged
merged 11 commits into from
Feb 14, 2022

Conversation

Jidapa-Pai
Copy link
Contributor

@Jidapa-Pai Jidapa-Pai commented Jan 18, 2022

Description

Fixes # (issue)
Step to reproduce:

  1. Programmatically set value by Javascript. e.g. set value from 0 to 10.
  2. Drag the slider back to 0.
    Result: The value-changed event is not fired. Try to reproduce here https://codepen.io/jidapa-pai/pen/XWeQdeO

The problem is when user programmatically set value the valuePrevious which is internal value didn't update so when drag the slider back to previous value, it not detect value change and not fires the value-changed event.
So, the solution is to update valuePrevious when the value was programmatically set.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 19, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 03f5663
Status: ✅  Deploy successful!
Preview URL: https://79a8fce0.refinitiv-ui.pages.dev

View logs

@Jidapa-Pai Jidapa-Pai added the bug Something isn't working label Jan 19, 2022
@Sakchai-Refinitiv
Copy link
Collaborator

@TremayneChrist @goremikins Do you want to skim this PR before merging?

@goremikins
Copy link
Contributor

I do not understand what is going on there and why as the code looks very messy :) but my guess is that the value-changed event should be fired not on blur, but when the drag is released.

@Sakchai-Refinitiv
Copy link
Collaborator

Sakchai-Refinitiv commented Feb 14, 2022

I do not understand what is going on there and why as the code looks very messy :) but my guess is that the value-changed event should be fired not on blur, but when the drag is released.

If you think the code should be refactored, we have the story for that one already and we can do in the next sprint.

@Theeraphat-Sorasetsakul
Copy link
Collaborator

I do not understand what is going on there and why as the code looks very messy :) but my guess is that the value-changed event should be fired not on blur, but when the drag is released.

I agreed the code like messy to read.
value-changed event is fired when drag is released. onBlur is for number-field.

@Theeraphat-Sorasetsakul Theeraphat-Sorasetsakul merged commit 687f244 into develop Feb 14, 2022
@Theeraphat-Sorasetsakul Theeraphat-Sorasetsakul deleted the fix-slider-not-fired-event branch February 14, 2022 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants