Dropdown key inputs stolen by JLab when the dropdown is collapsed
courtarro opened this issue · comments
Description
When a Dropdown widget is collapsed, any keyboard inputs supported by JupyterLab are intercepted and interpreted by JLab instead of the dropdown.
Seems related to #3836, which is still open but the discussion suggests it was fixed long ago.
Reproduce
- Create a cell containing the following code:
import ipywidgets as widgets
from ipywidgets import interact
@interact(name=widgets.Dropdown(options=['1', '2', '3', 'A', 'B', 'C']))
def report(name):
print(f'Output: {name}')
- Execute the cell
- Click the dropdown and press the
A
key on your keyboard. - Observe that the "A" item in the list is selected (correct behavior).
- Click the "1" item in the list to select it.
- Observe that the dropdown has collapsed and the border is blue, indicating that it should have focus.
- Press
A
on your keyboard again. - Observe that JupyterLab adds a cell above the current one (incorrect behavior) instead of selecting the "A" item in the list as expected
- Click the dropdown again, then once more to collapse it.
- Press the
up
ordown
arrows on your keyboard - Observe that JupyterLab changes cells (incorrect behavior) instead of changing the dropdown value as expected
Expected behavior
I expect that, when the dropdown widget is blue, any keyboard inputs that make sense in a normal dropdown will be interpreted and executed by the dropdown, not by JupyterLab.
Context
This occurs on a brand new install of JupyterLab and ipywidgets from PyPI.
- ipywidgets version: 8.1.1
- Operating System and version: Windows 10 22H2 (build 19045.4170)
- Browser and version: Chrome 123.0.6312.86
Troubleshoot Output
$PATH: C:\Program Files\ImageMagick C:\Program Files (x86)\VMware\VMware Workstation\bin\ C:\Program Files\Python310\Scripts\ C:\Program Files\Python310\ C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler C:\WINDOWS\system32 C:\WINDOWS C:\WINDOWS\System32\Wbem C:\WINDOWS\System32\WindowsPowerShell\v1.0\ C:\WINDOWS\System32\OpenSSH\ C:\Program Files\Microsoft VS Code\bin C:\Program Files\dotnet\ C:\Program Files\Microsoft SQL Server\150\Tools\Binn\ C:\Program Files\PuTTY\ C:\Program Files\GTK3-Runtime Win64\bin C:\Program Files\poppler-23.11.0\Library\bin C:\Program Files\Git\cmd C:\Users\(redacted)\AppData\Roaming\Python\Python310\Scripts C:\Program Files\Sysinternals C:\Program Files\ffmpeg\bin C:\Users\(redacted)\AppData\Local\Microsoft\WindowsAppssys.path:
C:\Users(redacted)\AppData\Roaming\Python\Python310\Scripts\jupyter-troubleshoot.EXE
C:\Program Files\Python310\python310.zip
C:\Program Files\Python310\DLLs
C:\Program Files\Python310\lib
C:\Program Files\Python310
C:\Users(redacted)\AppData\Roaming\Python\Python310\site-packages
C:\Users(redacted)\AppData\Roaming\Python\Python310\site-packages\win32
C:\Users(redacted)\AppData\Roaming\Python\Python310\site-packages\win32\lib
C:\Users(redacted)\AppData\Roaming\Python\Python310\site-packages\Pythonwin
C:\Program Files\Python310\lib\site-packages
C:\Program Files\Python310\lib\site-packages\vboxapi-1.0-py3.10.eggsys.executable:
C:\Program Files\Python310\python.exesys.version:
3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]platform.platform():
Windows-10-10.0.19045-SP0where jupyter:
C:\Users(redacted)\AppData\Roaming\Python\Python310\Scripts\jupyter.exepip list:
Package Version Editable project location
------------------------- -------------- -----------------------------
anyio 4.3.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
async-lru 2.0.4
attrs 23.2.0
Babel 2.14.0
beautifulsoup4 4.12.3
bleach 6.1.0
certifi 2024.2.2
cffi 1.16.0
charset-normalizer 3.3.2
colorama 0.4.6
comm 0.2.2
contourpy 1.2.1
cycler 0.12.1
debugpy 1.8.1
decorator 5.1.1
defusedxml 0.7.1
et-xmlfile 1.1.0
exceptiongroup 1.2.1
executing 2.0.1
fastjsonschema 2.19.1
fonttools 4.51.0
fqdn 1.5.1
h11 0.14.0
httpcore 1.0.5
httpx 0.27.0
idna 3.7
ipykernel 6.29.4
ipympl 0.9.4
ipython 8.24.0
ipython-genutils 0.2.0
ipywidgets 8.1.2
isoduration 20.11.0
jedi 0.19.1
Jinja2 3.1.3
joblib 1.4.0
json5 0.9.25
jsonpointer 2.4
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter 1.0.0
jupyter_client 8.6.1
jupyter-console 6.6.3
jupyter_core 5.7.2
jupyter-events 0.10.0
jupyter-lsp 2.2.5
jupyter_server 2.14.0
jupyter_server_terminals 0.5.3
jupyterlab 4.1.8
jupyterlab-execute-time 3.1.2
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.1
jupyterlab_widgets 3.0.10
kiwisolver 1.4.5
MarkupSafe 2.1.5
matplotlib 3.8.4
matplotlib-inline 0.1.7
mistune 3.0.2
nbclient 0.10.0
nbconvert 7.16.4
nbformat 5.10.4
nest-asyncio 1.6.0
notebook 7.1.3
notebook_shim 0.2.4
numpy 1.26.4
openpyxl 3.1.2
overrides 7.7.0
packaging 24.0
pandas 2.2.2
pandocfilters 1.5.1
parso 0.8.4
pillow 10.3.0
pip 24.0
platformdirs 4.2.1
prometheus_client 0.20.0
prompt-toolkit 3.0.43
psutil 5.9.8
pure-eval 0.2.2
pycparser 2.22
Pygments 2.17.2
pymore 1.0 C:\Users(redacted)\Software\pymore
pyparsing 3.1.2
python-dateutil 2.9.0.post0
python-json-logger 2.0.7
pytz 2024.1
pywin32 306
pywinpty 2.0.13
PyYAML 6.0.1
pyzmq 26.0.2
qtconsole 5.5.1
QtPy 2.4.1
referencing 0.35.0
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.18.0
scikit-learn 1.4.2
scipy 1.13.0
Send2Trash 1.8.3
setuptools 65.5.0
six 1.16.0
sniffio 1.3.1
soupsieve 2.5
stack-data 0.6.3
terminado 0.18.1
threadpoolctl 3.5.0
tinycss2 1.3.0
tomli 2.0.1
tornado 6.4
tqdm 4.66.2
traitlets 5.14.3
types-python-dateutil 2.9.0.20240316
typing_extensions 4.11.0
tzdata 2024.1
uri-template 1.3.0
urllib3 2.2.1
vboxapi 1.0
wcwidth 0.2.13
webcolors 1.13
webencodings 0.5.1
websocket-client 1.8.0
widgetsnbextension 4.0.10
Command Line Output
[I 2024-04-29 19:19:48.659 ServerApp] jupyter_lsp | extension was successfully linked. [I 2024-04-29 19:19:48.665 ServerApp] jupyter_server_terminals | extension was successfully linked. [I 2024-04-29 19:19:48.674 ServerApp] jupyterlab | extension was successfully linked. [I 2024-04-29 19:19:48.683 ServerApp] notebook | extension was successfully linked. [I 2024-04-29 19:19:49.075 ServerApp] notebook_shim | extension was successfully linked. [I 2024-04-29 19:19:49.129 ServerApp] notebook_shim | extension was successfully loaded. [I 2024-04-29 19:19:49.131 ServerApp] jupyter_lsp | extension was successfully loaded. [I 2024-04-29 19:19:49.132 ServerApp] jupyter_server_terminals | extension was successfully loaded. [I 2024-04-29 19:19:49.138 LabApp] JupyterLab extension loaded from C:\Users\(redacted)\AppData\Roaming\Python\Python310\site-packages\jupyterlab [I 2024-04-29 19:19:49.138 LabApp] JupyterLab application directory is C:\Users\(redacted)\AppData\Roaming\Python\share\jupyter\lab [I 2024-04-29 19:19:49.139 LabApp] Extension Manager is 'pypi'. [I 2024-04-29 19:19:49.155 ServerApp] jupyterlab | extension was successfully loaded. [I 2024-04-29 19:19:49.162 ServerApp] notebook | extension was successfully loaded. [I 2024-04-29 19:19:49.164 ServerApp] Serving notebooks from local directory: C:\Users\(redacted) [I 2024-04-29 19:19:49.164 ServerApp] Jupyter Server 2.14.0 is running at: [I 2024-04-29 19:19:49.164 ServerApp] http://localhost:8888/lab?token=(redacted) [I 2024-04-29 19:19:49.165 ServerApp] http://127.0.0.1:8888/lab?token=(redacted) [I 2024-04-29 19:19:49.165 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 2024-04-29 19:19:49.232 ServerApp]To access the server, open this file in a browser: file:///C:/Users/(redacted)/AppData/Roaming/jupyter/runtime/jpserver-81844-open.html Or copy and paste one of these URLs: http://localhost:8888/lab?token=(redacted) http://127.0.0.1:8888/lab?token=(redacted)
[I 2024-04-29 19:19:49.309 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[W 2024-04-29 19:19:52.194 LabApp] Could not determine jupyterlab build status without nodejs
[W 2024-04-29 19:20:37.725 ServerApp] Notebook (redacted) is not trusted
[I 2024-04-29 19:20:38.321 ServerApp] Kernel started: 714b96a8-eec8-4606-9a43-e240052a3128
[I 2024-04-29 19:20:39.907 ServerApp] Connecting to kernel 714b96a8-eec8-4606-9a43-e240052a3128.
[I 2024-04-29 19:20:39.932 ServerApp] Connecting to kernel 714b96a8-eec8-4606-9a43-e240052a3128.
[I 2024-04-29 19:20:39.955 ServerApp] Connecting to kernel 714b96a8-eec8-4606-9a43-e240052a3128.
[W 2024-04-29 19:20:40.010 ServerApp] Got events for closed stream <zmq.eventloop.zmqstream.ZMQStream object at 0x000001B7AF8B7520>
[W 2024-04-29 19:20:40.037 ServerApp] Got events for closed stream <zmq.eventloop.zmqstream.ZMQStream object at 0x000001B7ADEB9FF0>
[I 2024-04-29 19:22:27.822 LabApp]sys_prefix
level settings are read-only, usinguser
level for migration tolockedExtensions
[I 2024-04-29 19:22:27.838 LabApp]sys_prefix
level settings are read-only, usinguser
level for migration tolockedExtensions
[I 2024-04-29 19:22:27.855 LabApp]sys_prefix
level settings are read-only, usinguser
level for migration tolockedExtensions
[I 2024-04-29 19:22:38.627 ServerApp] Saving file at (redacted)
[W 2024-04-29 19:22:38.628 ServerApp] Notebook (redacted) is not trusted
[I 2024-04-29 19:22:58.356 LabApp]sys_prefix
level settings are read-only, usinguser
level for migration tolockedExtensions
[I 2024-04-29 19:22:58.373 LabApp]sys_prefix
level settings are read-only, usinguser
level for migration tolockedExtensions
[I 2024-04-29 19:22:58.389 LabApp]sys_prefix
level settings are read-only, usinguser
level for migration tolockedExtensions
[I 2024-04-29 19:23:02.266 ServerApp] Starting buffering for 714b96a8-eec8-4606-9a43-e240052a3128:d414ed7d-c4b1-4b06-9bb8-37cfe1af58fc
[W 2024-04-29 19:23:03.155 LabApp] Could not determine jupyterlab build status without nodejs
[I 2024-04-29 19:23:03.202 ServerApp] Connecting to kernel 714b96a8-eec8-4606-9a43-e240052a3128.
[I 2024-04-29 19:23:03.399 ServerApp] Starting buffering for 714b96a8-eec8-4606-9a43-e240052a3128:8240243c-55cd-47be-ab84-02e1024ea489
[W 2024-04-29 19:23:03.627 ServerApp] Notebook (redacted) is not trusted
[
Browser Output
JupyterLab extension jupyterlab-execute-time is activated! jlab_core.b91074b1e57242ddcd31.js?v=b91074b1e57242ddcd31:1 Scrolling to a new item is requested.
If using JupyterLab
- JupyterLab version: 4.1.8
Installed Labextensions
jupyter-matplotlib v0.11.4 enabled ok jupyterlab-execute-time v3.1.2 enabled ok (python, jupyterlab_execute_time) jupyterlab_pygments v0.3.0 enabled ok (python, jupyterlab_pygments) @jupyter-notebook/lab-extension v7.1.3 enabled ok @jupyter-widgets/jupyterlab-manager v5.0.10 enabled ok (python, jupyterlab_widgets)