Closed huong-li-nguyen closed 1 week ago
I don't think there's a particular reason for it to be missing, it should be added.
I can try to fix it :) Seems like it's just a one-line change?
Seems like it's just a one-line change?
Yes, maybe two lines, adding the id
prop in the function arguments then on the div.
Fixed by #2888
Describe your context Hello guys 👋
I am currently trying to pass an
id
to the dcc.Loading component or its parent container and I would like theid
to be visible in the DOM such that I can target the CSS of the components inside thedcc.Loading
via ID.Please provide us your environment, so we can easily reproduce the issue.
pip list | grep dash
belowif frontend related, tell us your Browser, Version and OS
Describe the bug Let's take the example app below - what I would have expected is that there would be an html div visible with a className="loading" and an id="loading-id". However, if I provide the
className="loading"
I see a div but it does not have the className="loading" in the DOM nor does it have the id="loading-id" in the DOM.When I switch this to
parent_className="loading"
, now I see a div with the className="loading", but I cannot attach an id to this parent container.I am not a react expert, but from the source I can see that the
id
doesn't seem to be passed on in the return of the react component and is therefore not visible in the DOM? Is there any reason for that?https://github.com/plotly/dash/blob/09252f8d2f690480cc468b2e015f9e2417dc90ad/components/dash-core-components/src/components/Loading.react.js#L128-L133
Expected behavior
I would expect the
id
being passed on to the react component and visible in the DOM, so having a <div class="loading" id="loading-id"Screenshots![Screenshot 2024-06-07 at 12 29 36](https://github.com/plotly/dash/assets/90609403/b2f921bd-2a46-4073-8615-61d348f485b3)