Skip to content

Commit

Permalink
Properly refocus the editor on pointer clicks even if it already is t…
Browse files Browse the repository at this point in the history
…he active element

FIX: Fix an issue where clicking wouldn't focus the editor on Firefox when
it was in an iframe and already the active element of the frame.

Closes codemirror/dev#1195
  • Loading branch information
marijnh committed Jun 30, 2023
1 parent 3df8b37 commit 2500faf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ handlers.mousedown = (view, event: MouseEvent) => {
}
if (!style && event.button == 0) style = basicMouseSelection(view, event)
if (style) {
let mustFocus = view.root.activeElement != view.contentDOM
let mustFocus = !view.hasFocus
view.inputState.startMouseSelection(new MouseSelection(view, event, style, mustFocus))
if (mustFocus) view.observer.ignore(() => focusPreventScroll(view.contentDOM))
if (view.inputState.mouseSelection) view.inputState.mouseSelection.start(event)
Expand Down

0 comments on commit 2500faf

Please sign in to comment.