-
Notifications
You must be signed in to change notification settings - Fork 945
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
displayed promise should probably trigger on after-show if widget is initially invisible #2762
Comments
I guess this is a bit related to #2605. We might want the |
Right now, it looks like the layout is applied by the displayed trigger. Perhaps the layout should be applied immediately on creation. Since it is just changing DOM node styling, I don't think it has to be applied after it is attached. It just has to be applied after the children nodes are built for the querying logic to work. |
Note that the attach signal means that the widget is attached to the DOM, and not just floating somewhere. I would want to check if this is significant for anything (e.g. any use of selectors). |
On the other hand, we could just encourage people to process the Lumino |
Did anything come up where having |
I didn't look very deep, but I think this would be a very narrow case. Happy to disregard until someone comes complaining :) |
We discussed this on today's dev meeting, and concluded that it might be best to add three new promises:
This will allow for third-party libraries to update on their own time, but still reducing the ambiguity of the promise names. Further input is of course welcome 😄 |
I like this idea, and how it provides a gradual upgrade path and removes the ambiguity. Another approach would be to still deprecate the displayed promise, but document how to listen for the after-attach and after-show messages in Lumino, i.e., punt the problem over to Lumino. The nice thing about this approach is that it doesn't just assume that these messages only happen once, i.e., if we ever reuse a widget view, the messages are appropriately sent. |
Right now, the Javascript side of a widget has a
displayed
promise that triggers onafter-attach
. However, some libraries actually need to know when they are visible on the page, not just attached (for example, initially sizing things in bqplot needs to measure its size after the browser has laid out things). This comes up if your widget is in a non-active tab in the stock Tab widget, for example, where theafter-attach
event triggers because you are added to the DOM, but you are not visible until later, when the user clicks on the tab (and then your widget gets a Luminoafter-show
event).Should we:
A. change the semantics of the displayed promise to only trigger on
after-attach
if the widget is visible, and trigger on the firstafter-show
otherwise?B. Leave
displayed
to be tied toafter-attach
and push the logic down to the widget author. If you really need to wait until you have visibility, set up their own promise that waits for anafter-show
event after the displayed event? Or if you are already setting up Lumino event processing in your custom widget, perhaps you should tie into the Luminoafter-attach
event instead of the ipywidgetsdisplayed
promise?I think A probably makes sense? Are there widgets that will want to do some processing after attachment even if they are invisible?
The text was updated successfully, but these errors were encountered: