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
Improve UX of non-interactive slider #7814
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/219f2f4a5af408ed3733c3841670242944a79d64/gradio-4.22.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@219f2f4a5af408ed3733c3841670242944a79d64#subdirectory=client/python" |
@Pythongor Can you please add a comparison screenshot after the fix here, so we can take a look without running the code. |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
Fixed the stories and also fixed a small bug that mean the background size wasn't being coloured in when the max was not set. |
const dividend = Number(rangeInput.value) - Number(rangeInput.min); | ||
const divisor = Number(rangeInput.max) - Number(rangeInput.min); | ||
const h = divisor === 0 ? 0 : dividend / divisor; | ||
rangeInput.style.backgroundSize = h * 100 + "% 100%"; |
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.
Just added some checks so we don't get infinity.
@@ -24,7 +24,7 @@ | |||
export let scale: number | null = null; | |||
export let min_width: number | undefined = undefined; | |||
export let minimum: number; | |||
export let maximum: number; | |||
export let maximum = 100; |
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.
Default for browser is 100 anyway, so just set this explicitly, to avoid undefined values.
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.
Looks great. Thanks for tackling this @Pythongor!
Description
This pull request makes the slider look more logical and compliant with UX standards. Now in the inactive state the slider looks more subdued and the cursor on the hover is displayed correctly.
Closes: #7813