Skip to content

Commit b5fe24a

Browse files
committed
widgets: fix issue with editing numbers on sliders
1 parent aa126e9 commit b5fe24a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/packages/frontend/jupyter/keyboard.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,17 @@ export function create_key_handler(
119119
const mode = frame_actions.store.get("mode");
120120
if (mode === "escape") {
121121
const focused = $(":focus");
122-
if (focused.length > 0 && focused[0].tagName != "DIV") {
122+
if (
123+
focused.length > 0 &&
124+
(focused[0].tagName != "DIV" ||
125+
focused[0].className?.includes("widget-readout"))
126+
) {
123127
// Never use keyboard shortcuts when something is focused, e.g.,
124128
// getting a password or using text input widget. However, the cell list DIV
125129
// itself gets focused often, so we have to avoid that special case.
130+
// An example with ipywidgets that the className case above covers:
131+
// import ipywidgets as widgets; w = widgets.IntSlider(0,1,100); w
132+
// Then put your cursor in the number to the right of the slider and hit backspace.
126133
return;
127134
}
128135
}

0 commit comments

Comments
 (0)