Skip to content

Fix Cmd+V paste not working in GitHub sign-in WebView#17

Merged
lazzurs merged 1 commit intomainfrom
copilot/fix-paste-functionality-sign-in-page
Mar 7, 2026
Merged

Fix Cmd+V paste not working in GitHub sign-in WebView#17
lazzurs merged 1 commit intomainfrom
copilot/fix-paste-functionality-sign-in-page

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

WKWebView on macOS silently consumes keyboard equivalents (Cmd+V, etc.) instead of forwarding them through the AppKit responder chain to web content. Right-click paste worked because it goes through a separate context menu path.

Changes

  • GitHubWebAuthClient.swift: Introduces a private EditableWebView: WKWebView subclass that overrides performKeyEquivalent(with:) to dispatch editing shortcuts via NSApp.sendAction:
private class EditableWebView: WKWebView {
    override func performKeyEquivalent(with event: NSEvent) -> Bool {
        guard event.modifierFlags.contains(.command),
              let key = event.charactersIgnoringModifiers else {
            return super.performKeyEquivalent(with: event)
        }
        switch key {
        case "v": return NSApp.sendAction(#selector(NSText.paste(_:)),      to: nil, from: self)
        case "c": return NSApp.sendAction(#selector(NSText.copy(_:)),       to: nil, from: self)
        case "x": return NSApp.sendAction(#selector(NSText.cut(_:)),        to: nil, from: self)
        case "a": return NSApp.sendAction(#selector(NSText.selectAll(_:)),  to: nil, from: self)
        default:  return super.performKeyEquivalent(with: event)
        }
    }
}
  • showLoginWindow() now instantiates EditableWebView instead of plain WKWebView. All other behaviour is unchanged.
Original prompt

This section details on the original issue you should resolve

<issue_title>Paste does not work on sign in page</issue_title>
<issue_description>For some reason paste does not work on the sign in page using cmd-v however it is available when right clicking in the password box.

Pasting passwords should be allowed.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix paste functionality on sign in page Fix Cmd+V paste not working in GitHub sign-in WebView Mar 1, 2026
@lazzurs
Copy link
Contributor

lazzurs commented Mar 2, 2026

@copilot rebase

Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot rebase

Rebasing requires a force push, which isn't available in this environment. Could you rebase the branch manually, or merge the latest main into this branch? The code change itself is a single-file, non-conflicting addition so it should apply cleanly.

@lazzurs lazzurs force-pushed the copilot/fix-paste-functionality-sign-in-page branch from 2cb6f3a to 8e87e13 Compare March 7, 2026 00:35
@lazzurs lazzurs force-pushed the copilot/fix-paste-functionality-sign-in-page branch from 8e87e13 to 8ff7eb0 Compare March 7, 2026 00:36
@lazzurs lazzurs marked this pull request as ready for review March 7, 2026 00:40
@lazzurs lazzurs merged commit f38ac81 into main Mar 7, 2026
3 checks passed
@lazzurs lazzurs deleted the copilot/fix-paste-functionality-sign-in-page branch March 7, 2026 00:41
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.

Paste does not work on sign in page

2 participants