Skip to content

Using pen input is difficult with widgets due to context menu triggering #3994

@martenrichter

Description

@martenrichter

Description

I am using jupyter-widgets mainly to visualize graphs in physics lectures.
Though Jupyter-Widgets works excellent, I have an issue with the Wacom graphic tablets in our lecture hall.
Interacting with the widget does not work well, as if you miss the slider (e.g.) and press only a tiny bit off to the knob, I likely trigger the context menu of the browser.
This also happens on my ChromeBook with pen, but not as frequently as with the windows PC and the wacom tablet.

Reproduce

Open an example with a widget on a pen-based device (preferably with Wacom on windows) and try to move a slider, for example, then you will see that the context menu is triggered, if you are not hitting the controls.

Expected behavior

The context menu should not be triggered,

Context

It was on jupyter lite recent version, but it does not matter.

Solution

Attach to widgets (or parents) a handler with, e.g.:

   clone.node.addEventListener('contextmenu', e => {
      e.preventDefault();
    });

This works in my custom setup (I use a parent of the widgets). So for me, it is fixed. However, it may be a good idea to make this the default for many widgets.
I did not make a patch, as I do not know what is desired in a greater context, and the fix is relatively easy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions