diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index f4d80e94a7..0836ebe54e 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -17,7 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - ### Fixed -- +- Fixed a bug that windows user could not open the context menu as it instantly closed after opening. [#5756](https://github.com/scalableminds/webknossos/pull/5756). ### Removed - diff --git a/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.js b/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.js index 668edb4df7..ef243f5d28 100644 --- a/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.js +++ b/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.js @@ -164,12 +164,20 @@ class TracingLayoutView extends React.PureComponent { globalPosition: Vector3, viewport: OrthoView, ) => { - this.setState({ - contextMenuPosition: [xPos, yPos], - clickedNodeId: nodeId, - contextMenuGlobalPosition: globalPosition, - contextMenuViewport: viewport, - }); + // On Windows the right click to open the context menu is also triggered for the overlay + // of the context menu. This causes the context menu to instantly close after opening. + // Therefore delay the state update to delay that the context menu is rendered. + // Thus the context overlay does not get the right click as an event and therefore does not close. + setTimeout( + () => + this.setState({ + contextMenuPosition: [xPos, yPos], + clickedNodeId: nodeId, + contextMenuGlobalPosition: globalPosition, + contextMenuViewport: viewport, + }), + 0, + ); }; hideContextMenu = () => {