-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Change the label of a Toolbarbutton after creation / make a button inactive #10307
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
jupyterlab-git kind of workarounds a similar issue for file browser toolbar by wrapping the button component in a react widget, which might not work in your case: https://github.com/jupyterlab/jupyterlab-git/blob/9df356280b544b8f0e2236ef0757d57a6239ca7c/src/widgets/gitClone.tsx#L13-L42 Another workaround-idea - have you tried something like:
Even if the workaround works for you I agree it is a useful thing to have in the official API. |
Interesting ... button.node.querySelector('button').disabled = true; is disabling the button, but you can click and the callback is running again. I thought that this has something to do with the mouse handler, but setting actualClick to true gives the same result. I mean I can check if the first callback is still running, but this is not the best implementation. I'm not sure if this a typical behaviour of Chrome and Safari that a disabled button is still clickable. But anyway, to implement this correctly in the official API should be easy. |
What about something like the save button in notebook toolbar? jupyterlab/packages/notebook/src/default-toolbar.tsx Lines 82 to 97 in 2137872
(I still agree if would be handy to improve |
Problem
In my extension I have created a ToolbarButton for Notebooks:
const button = new ToolbarButton({
label: 'Validate',
className: 'myButton',
onClick: callback,
tooltip: 'Validate Notebook'
});
Since a validation will take some time, first I want to "deactivate" the button and change the label to "Validating ..." . Somehow I cannot find a good solution in the class members in ToolbarButton.
Proposed Solution
Additional context
As fas as I can remember in the old notebook style this was possible due to directly changing the html-values of the button which is not possible in jupyterlab!
The text was updated successfully, but these errors were encountered: