Skip to content

Arrow keys (Up/Down/Left/Right) don't work for AG-Grid navigation in Jupyter Notebook - intercepted for notebook scrolling #7716

@meitham

Description

@meitham

Description

Arrow navigations with left/right/up/down works in ipyaggrid in JupyterLab and JupyterLab Classic, but fails to work in JupyterLab Notebook (see provided example).

In JupyterLab Notebook the arrow keys are interpreted as navigations across the notebook cells, instead of the agggrid cells, even when aggrid is in focus. This works correctly in both Lab and Classic views and the issue is limited to Notebook view.

Reproduce

  1. Save the provided code as a jupyter notebook and run
  2. Click on any cell in the AGGrid
  3. Use arrow keys to navigate between AGGrid cells
  4. Open the same notebook in Notebook mode
  5. Arrow keys no longer work inside AGGrid
  6. Repeat this in classic mode and it works again

Expected behavior

The arrow keys navigation should work in Notebook mode, just like it works under Lab and Classic.

Context

  • Operating System and version: windows 10 or windows 11
  • Browser and version: reproducible across all versions of firefox and chrome
  • Jupyter Notebook version: 7.4.5
  • notebook==7.4.5
  • jupyterlab==4.4.6
  • ipython==9.4.0
  • ipykernel==6.30.1
  • ipyaggrid==0.5.4
Notebook example to reproduce
import pandas as pd

from ipyaggrid import Grid

df = pd.DataFrame({
'Name': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'],
'Age': [25, 30, 35, 28, 32],
'City': ['New York', 'London', 'Paris', 'Tokyo', 'Sydney'],
'Score': [95.5, 87.2, 92.1, 88.9, 91.3]
})

grid_options = {
'columnDefs': [
{'field': 'Name'},
{'field': 'Age'},
{'field': 'City'},
{'field': 'Score'}
],
'defaultColDef': {
'sortable': True,
'filter': True,
'resizable': True
},
'enableRangeSelection': True,
'animateRows': True
}

grid = Grid(
grid_data=df,
grid_options=grid_options,
theme='ag-theme-balham-dark',
height=300
)

grid

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions