Skip to content

Commit

Permalink
widgets: fix issue with editing numbers on sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
williamstein committed Jul 23, 2024
1 parent aa126e9 commit b5fe24a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/packages/frontend/jupyter/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,17 @@ export function create_key_handler(
const mode = frame_actions.store.get("mode");
if (mode === "escape") {
const focused = $(":focus");
if (focused.length > 0 && focused[0].tagName != "DIV") {
if (
focused.length > 0 &&
(focused[0].tagName != "DIV" ||
focused[0].className?.includes("widget-readout"))
) {
// Never use keyboard shortcuts when something is focused, e.g.,
// getting a password or using text input widget. However, the cell list DIV
// itself gets focused often, so we have to avoid that special case.
// An example with ipywidgets that the className case above covers:
// import ipywidgets as widgets; w = widgets.IntSlider(0,1,100); w
// Then put your cursor in the number to the right of the slider and hit backspace.
return;
}
}
Expand Down

0 comments on commit b5fe24a

Please sign in to comment.