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

Decimal numbers are sometimes being cut-off in sliders/range-sliders #361

Open
1 task done
huong-li-nguyen opened this issue Mar 12, 2024 · 2 comments
Open
1 task done
Assignees
Labels
Issue: Bug Report 🐛 Issue/PR that report/fix a bug

Comments

@huong-li-nguyen
Copy link
Contributor

huong-li-nguyen commented Mar 12, 2024

Description

Decimal numbers are sometimes being cut-off in sliders/range-sliders.

Screenshot 2024-03-12 at 10 00 53

This seems to only happen when the step argument is not defined. When the step argument is defined the max-width of the input field seems to scale correctly:

Screenshot 2024-03-12 at 14 52 27

However, it doesn't always happen, so it doesn't seem to be a pure CSS issue as e.g. these work:
Screenshot 2024-03-12 at 10 02 11

Expected behavior

Input field expanding to its content and not cutting of digits after the separator.

Which package?

vizro

Package version

0.1.12

Python version

3.9

OS

How to Reproduce

Run any example with sliders

Output

No response

Code of Conduct

@huong-li-nguyen huong-li-nguyen added Issue: Bug Report 🐛 Issue/PR that report/fix a bug Status: Needs triage 🔍 Issue/PR needs triaging labels Mar 12, 2024
@huong-li-nguyen huong-li-nguyen removed the Status: Needs triage 🔍 Issue/PR needs triaging label Mar 12, 2024
@nadijagraca
Copy link
Contributor

nadijagraca commented Mar 13, 2024

Initial results of investigation:

The decimal numbers are cut off in the input fields, if the text value has more digits than the sliders/range-sliders max value. In the example below, range slider is defined as vm.Slider(min=1957, max=2007), since step is not defined it defaults to None. If step is None slider will calculate the step size, and based on the dataset in this case step was set to 0.5.

Since selected value 1974.5 has 5 digits and max value (2007) has 4 digits, the last digit of the value in the input field will be cut-off as the max-width of the input field is dependent on the number of digits of the max argument (adding decimal places to max does not help).

Screenshot 2024-03-12 at 10 00 53

Conclusion:
The bug seems to be on Dash (as it can be replicated in a pure dash app), an issue has been raised from our side in the Dash repository: 2791

Until it has been fixed on Dash, we recommend setting the step argument for Slider/RangeSlider such that the text field is not being cut-off and scales accordingly.

@huong-li-nguyen
Copy link
Contributor Author

@maxschulz-COL - FYI for the bug you've mentioned in the last PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Bug Report 🐛 Issue/PR that report/fix a bug
Projects
None yet
Development

No branches or pull requests

2 participants