Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug #2063: editable elements focus and blur correction #2093

Merged
merged 1 commit into from
Nov 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/dd-draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
const name = (e.target as HTMLElement).nodeName.toLowerCase();
if (skipMouseDown.find(skip => skip === name)) return true;

//for contenteditable
if((e.target as HTMLElement).closest('[contenteditable="true"]')) return true;

// make sure we are clicking on a drag handle or child of it...
// Note: we don't need to check that's handle is an immediate child, as mouseHandled will prevent parents from also handling it (lowest wins)
//
Expand All @@ -153,8 +156,13 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
this.dragEl.addEventListener('touchmove', touchmove);
this.dragEl.addEventListener('touchend', touchend);
}

e.preventDefault();

//e.preventDefault() prevents blur event which occurs just after mousedown event.
//if an editable content has focus, then blur must be call
if(document.activeElement) (document.activeElement as HTMLElement).blur();

DDManager.mouseHandled = true;
return true;
}
Expand Down