Comments (6)
@Coding-with-Adam @nadijagraca I am seeing the issue on Mac in Safari and Chrome. No issue in Firefox because the box is wider overall in Firefox. I wonder what is causing the width difference between browsers.
With step=None
on the dcc.Input
:
Odd that the width of the box is affected by the value of step
!
Worth noting, though, that setting step=None
isn't really valid according to the docs — the default value for step
is "any"
. Setting step="any"
, or not passing a value for step
at all, gives a wider box, even in Safari/Chrome:
If I were to guess I would say dcc.Input
is doing some fancy logic to try to guess the minimum length needed for the input box, but is not handling the null value correctly.
from dash.
After another look I see that dcc.Input
is a pretty light wrapper around the HTML <input>
component, and the logic around choosing the box width is implemented by the browser, based on the min
, max
and step
values. Which explains why the behavior is different across browsers.
So the answer here I think is
- set
step="any"
(or don't pass a value forstep
, meaning the default of"any"
will be used) to nudge the browser to use the 'default' input field width which is around 20 characters, OR - use CSS to set a different, custom, width if needed
from dash.
HI @nadijagraca
Thank you for reporting this. Can you please share a minimal reproducible example code so we can replicated this bug locally?
from dash.
Hi Adam,
Apologies for not including it.
Below you can find example code. If you replace step=None
with step=0.5
the number in the input field is displayed correctly.
from dash import Dash, Input, Output, callback, dcc, html
app = Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="input-slider", type="number", min=1957, max=2007, step=None, value=1990),
dcc.Slider(
id="slider", min=1957, max=2007, marks=None, value=1990, dots=False, step=None, updatemode="drag"
),
]
)
@callback(Output("input-slider", "value"), Input("slider", "value"))
def update_output(value):
return value
if __name__ == '__main__':
app.run(debug=True)
To replicate the bug you will need to use slider handle, and once the slider handle is dragged to the number with decimal place, you will notice that the decimal place is being cut-off from the input field.
from dash.
hi @nadijagraca
Thanks for sharing the code. For some reason, I'm not able to reproduce the error. I ran your code as step=None
and step=0.5
, and in bot cases the complete number/float is visible.
I'm using Dash 2.16.1 on a Windows 11. And it worked fine on Firefox, Edge, and Brave.
Can you try Dash 2.16.1? What OS are you using?
from dash.
Thank you for the solution, @emilykl
from dash.
Related Issues (20)
- [Feature Request] Expose `dash.NoUpdate` for Type Hinting HOT 6
- Delete Data from Heat Figs with Patch() [Feature Request] HOT 3
- [Feature Request] Global set_props in backend callbacks. HOT 2
- [BUG] The `infer_jupyter_proxy_config` method does not work due to timeout
- CI broken due to `flaky` incompatibility with latest `pytest`
- Improved Datatables HOT 3
- Background callbacks with celery + redis getting 204s HOT 1
- How does the new version of dash dynamically create callback HOT 1
- When there are three identical outputs, the allow_duplicate is set and an error will be reported. HOT 5
- dash title design issues HOT 3
- [BUG] When using multiple instances of dash on a flask server, they cannot share the same page name, even though they have different url routes HOT 3
- How does dash combine with flask jwt? HOT 1
- The problem of parameter transparency between dash custom components HOT 1
- Running argument in a callback breaks when provided with a dictionary as an component_id instead of a string HOT 2
- [BUG] Dash Testing: `wait_for_text_to_equal` may incorrectly succeed when used with text `"None"` HOT 1
- [Feature Request] Allow dcc.Dropdown with multi=True to stay open when item is selected HOT 3
- Can callback be set to take effect with the current page or globally HOT 1
- [BUG] Using gunicorn to deploy a dash app with plotly-resampler in Linux, and the figure didnt render correctly
- [BUG] cannot pickle 'SSLContext' with background callback HOT 5
- [BUG] A progress callable of a bg callback sometimes doesn't trigger. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash.