marimo icon indicating copy to clipboard operation
marimo copied to clipboard

mo.ui.slider with very small step value does not work

Open vangberg opened this issue 1 year ago • 2 comments

Describe the bug

If I create a slider with a step value of 10**-7 the slider does not respond. A step value of 10**-06 works fine.

https://github.com/user-attachments/assets/177b352c-8689-46f0-a926-043cda5133d1

Environment

{ "marimo": "0.9.6", "OS": "Darwin", "OS Version": "22.3.0", "Processor": "arm", "Python Version": "3.12.6", "Binaries": { "Browser": "129.0.6668.91", "Node": "v22.9.0" }, "Dependencies": { "click": "8.1.7", "importlib-resources": "missing", "jedi": "0.19.1", "markdown": "3.7", "pygments": "2.18.0", "pymdown-extensions": "10.10.1", "ruff": "0.6.7", "starlette": "0.39.0", "tomlkit": "0.13.2", "typing-extensions": "4.12.2", "uvicorn": "0.30.6", "websockets": "12.0" }, "Optional Dependencies": {} }

Code to reproduce

import marimo as mo

works = mo.ui.slider(10**-7, 10**-5, 10**-6, show_value=True)

fails = mo.ui.slider(10**-7, 10**-5, 10**-7, show_value=True)

vangberg avatar Oct 11 '24 11:10 vangberg

This is coming from an upstream library and looking through their code, its likely a rounding issue.

The seemed to fix this for small numbers, but I am guessing not this small. https://github.com/radix-ui/primitives/issues/462 https://github.com/radix-ui/primitives/pull/463

mscolnick avatar Oct 11 '24 13:10 mscolnick

we may have better luck switching to react-aria-components

https://react-spectrum.adobe.com/react-aria/Slider.html

mscolnick avatar Oct 11 '24 14:10 mscolnick

I am using

dependencies = [
    "marimo>=0.14.12",
]

still cannot use the slider, even though the PR has already merged. Would you like me to explore the React ARIA slide? @mscolnick ?

Image

rubiagatra avatar Jul 21 '25 08:07 rubiagatra

@rubiagatra, yes if you are open to exploring migrating ot react-aria-components, that would be really appreciated.

it would be good first to check if they support this small of a step, before doing doing the full migration

mscolnick avatar Jul 22 '25 13:07 mscolnick