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

Trigger text diff search plugin even when CodeMirror doesn't have focus #7899

Merged
merged 8 commits into from Jul 3, 2019

Conversation

niik
Copy link
Member

@niik niik commented Jul 2, 2019

Overview

We shipped #7866 in 2.1.0. One limitation of the implementation there is that since CodeMirror is responsible for handling the keyboard shortcut it will never trigger unless the editor is focused (this was described in #7866).

Description

This PR adds a menu item under the Edit menu which dispatches a custom event (similar to how we deal with select-all). The TextDiff component then registers an event handler on the document node allowing it to catch CmdOrCtrl+F regardless of what element is in focus. If one or more components are active and subscribing to this event the first one to register will get the opportunity to handle it first. Right now there are only ever one text diff active in the app at any given time so that's okay.

In the future we might want to either de-scope the focus area or have other component do so but we'll cross that bridge if and when we get there.

Release notes

Notes: no-notes

@niik niik added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 2, 2019
@billygriffin billygriffin added this to Needs to be Prioritized in PR Priority via automation Jul 2, 2019
@outofambit outofambit moved this from Needs to be Prioritized to ⭐️ PR Reviewable Priority ⭐️ in PR Priority Jul 2, 2019
@tierninho tierninho self-requested a review July 2, 2019 20:49
Copy link
Contributor

@outofambit outofambit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! just one question about labelling

PR Priority automation moved this from ⭐️ PR Reviewable Priority ⭐️ to Awaiting Merge Jul 2, 2019
@outofambit outofambit self-assigned this Jul 2, 2019
Copy link
Contributor

@tierninho tierninho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing notes:

  • cmd-F is functional with Edit menu option intact
  • Search box opens regardless of what element is in focus
  • search box opens on text files only; binary files ignored
  • search box opens on diffs accessed from Stash, Changes, History, Compare branches
  • search box opens on new files, edited files, and deleted files

4663fe9, mac

@outofambit outofambit merged commit b7271a2 into development Jul 3, 2019
PR Priority automation moved this from Awaiting Merge to Done Jul 3, 2019
@outofambit outofambit deleted the diff-search-shortcut branch July 3, 2019 16:31
@outofambit outofambit added this to In Progress in Desktop 2.1.2 release via automation Jul 15, 2019
@outofambit outofambit moved this from In Progress to Done in Desktop 2.1.2 release Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants