Skip to content

Commit

Permalink
Merge branch 'recogito#133-fix-not-dismissed-annotation-on-outside-cl…
Browse files Browse the repository at this point in the history
…ick' into keyboard-event-selection

# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
  • Loading branch information
oleksandr-danylchenko committed Sep 10, 2024
2 parents cbe374d + 92e4156 commit 43872e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ export const SelectionHandler = (
* to the initial pointerdown event and remember the button
*/
const onPointerDown = (evt: PointerEvent) => {
const annotatable = !(evt.target as Node).parentElement?.closest(NOT_ANNOTATABLE_SELECTOR);
if (!annotatable) return;

/**
* Cloning the event to prevent it from accidentally being `undefined`
* @see https://github.com/recogito/text-annotator-js/commit/65d13f3108c429311cf8c2523f6babbbc946013d#r144033948
Expand All @@ -167,8 +170,7 @@ export const SelectionHandler = (

const onPointerUp = (evt: PointerEvent) => {
const annotatable = !(evt.target as Node).parentElement?.closest(NOT_ANNOTATABLE_SELECTOR);
if (!annotatable || !isLeftClick)
return;
if (!annotatable || !isLeftClick) return;

// Logic for selecting an existing annotation
const clickSelect = () => {
Expand Down

0 comments on commit 43872e8

Please sign in to comment.