-
Notifications
You must be signed in to change notification settings - Fork 116
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(slider): Migrate to custom slider due to range input limitations #1410
Conversation
if (!sliderEl) return 0; | ||
|
||
const { width: sliderWidth } = sliderEl.getBoundingClientRect(); | ||
const newValue = (getPosition(pageX) / sliderWidth) * max; |
There was a problem hiding this 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 worry about decimal values here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd want to let the consuming component handle rounding to avoid making assumptions about its use. Videos can have durations defined as decimal values, for whatever reason, for example.
}, []); | ||
|
||
const getPositionValue = React.useCallback( | ||
(pageX: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does tslint not care about the return types for these anonymous functions used in useCallback
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't. It looks like the return value is being inferred correctly in this case, though, so maybe that's why?
setIsScrubbing(true); | ||
}; | ||
|
||
React.useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any issues with this when doing a quick click and drag and release interaction with the slider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen any issues in my testing, but will keep an eye out as we build more features with this component.
No description provided.