Skip to content

Add condition to refreshVisibleSearch in NotesEditor refs #942 - #943

Open
meusistemabr wants to merge 1 commit into
massCodeIO:mainfrom
meusistemabr:meusistemabr-fix/editor-focus-loss
Open

meusistemabr wants to merge 1 commit into
massCodeIO:mainfrom
meusistemabr:meusistemabr-fix/editor-focus-loss

Conversation

@meusistemabr

Copy link
Copy Markdown

What kind of change does this PR introduce?

Description

Fixes an annoying bug where CodeMirror 6 loses focus completely a few seconds after the user stops typing inside a note.

Cause

The refreshVisibleSearch(false) or content.value mutation called asynchronously inside CodeMirror's updateListener triggers a reactive update/re-mount of the view elements, ripping the active selection and focus away from document.activeElement while the user is inside the editor.

check at least one

  • Bugfix
  • Feature
  • Refactor
  • Other, please describe:

Solution

Added an update.view.hasFocus validation to prevent the update listener from executing destructive reactive side effects while the editor view is actively focused by the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant