From 2f58ccb29e05e817597db9117be59dd3f05fc884 Mon Sep 17 00:00:00 2001 From: Philipp Otto Date: Mon, 8 Jan 2024 17:22:28 +0100 Subject: [PATCH 1/2] fix that addEventListenerWithDelegation could crash on non-Element event targets --- frontend/javascripts/libs/utils.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/javascripts/libs/utils.ts b/frontend/javascripts/libs/utils.ts index 276b5ec7d10..668a3246b93 100644 --- a/frontend/javascripts/libs/utils.ts +++ b/frontend/javascripts/libs/utils.ts @@ -765,10 +765,12 @@ export function addEventListenerWithDelegation( handlerFunc: (...args: Array) => any, options: Record = {}, ) { - const wrapperFunc = function (event: Event) { - // @ts-ignore - for (let { target } = event; target && target !== this; target = target.parentNode) { - // @ts-ignore + const wrapperFunc = function (this: HTMLElement | Document, event: Event) { + for ( + let { target } = event; + target && target !== this && target instanceof Element; + target = target.parentNode + ) { if (target.matches(delegateSelector)) { handlerFunc.call(target, event); break; From b279bef9bfe91e5331ea3f63ee1b70a8017c75ee Mon Sep 17 00:00:00 2001 From: Philipp Otto Date: Mon, 8 Jan 2024 17:30:48 +0100 Subject: [PATCH 2/2] update changelog --- CHANGELOG.unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index ccfbb509ff8..9185fb9d5a1 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -36,6 +36,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed a bug where meshes (or chunks of them) were always colored white, if they were loaded while the corresponding segmentation layer was disabled. [#7507](https://github.com/scalableminds/webknossos/pull/7507) - Fixed a race condition when opening a short link, that would sometimes lead to an error toast. [#7507](https://github.com/scalableminds/webknossos/pull/7507) - Fixed that the Segment Statistics feature was not available in the context menu of segment groups and in the context menu of the data viewports. [#7510](https://github.com/scalableminds/webknossos/pull/7510) +- Fixed rare bug which produced a benign error toast on some mouse interactions. [#7525](https://github.com/scalableminds/webknossos/pull/7525) ### Removed