diff --git a/doc/api/next_api_changes/behavior/18172-IHI.rst b/doc/api/next_api_changes/behavior/18172-IHI.rst new file mode 100644 index 000000000000..6a88acbeb71a --- /dev/null +++ b/doc/api/next_api_changes/behavior/18172-IHI.rst @@ -0,0 +1,6 @@ +webAgg backend no longer reports a middle click as a right click +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Previously when using the webAgg backend the event passed to a callback +by ``fig.canvas.mpl_connect('mouse_button_event', callback)`` on a middle click +would report `.MouseButton.RIGHT` instead of `.MouseButton.MIDDLE` diff --git a/lib/matplotlib/backends/backend_webagg_core.py b/lib/matplotlib/backends/backend_webagg_core.py index 2155381fbd77..20a5676c4bf1 100644 --- a/lib/matplotlib/backends/backend_webagg_core.py +++ b/lib/matplotlib/backends/backend_webagg_core.py @@ -260,14 +260,6 @@ def _handle_mouse(self, event): # off by 1 button = event['button'] + 1 - # The right mouse button pops up a context menu, which - # doesn't work very well, so use the middle mouse button - # instead. It doesn't seem that it's possible to disable - # the context menu in recent versions of Chrome. If this - # is resolved, please also adjust the docstring in MouseEvent. - if button == 2: - button = 3 - e_type = event['type'] guiEvent = event.get('guiEvent', None) if e_type == 'button_press':