Skip to content

Fix editing shortcuts in browser docks on macOS - #557

Closed
Michael-Liendo wants to merge 1 commit into
obsproject:masterfrom
Michael-Liendo:fix/macos-edit-shortcuts
Closed

Michael-Liendo wants to merge 1 commit into
obsproject:masterfrom
Michael-Liendo:fix/macos-edit-shortcuts

Conversation

@Michael-Liendo

@Michael-Liendo Michael-Liendo commented Oct 24, 2026 •

Copy link
Copy Markdown

Description

Handle the standard editing shortcuts (Cmd+X, Cmd+C, Cmd+V, Cmd+A, Cmd+Z and Shift+Cmd+Z) in QCefBrowserClient::OnPreKeyEvent on macOS and forward them to the focused frame. If no frame has focus, they go to the main frame.

Motivation and Context

On macOS, CEF relies on the application's Edit menu to send the standard editing selectors (cut:, copy:, paste:, selectAll:, undo:, redo:) to the focused browser view. OBS's Edit menu uses its own actions instead, such as Paste Reference and Paste Duplicate. As a result, Cmd+V and the other editing shortcuts do nothing in browser docks.

A concrete case is the YouTube Live Control Panel: you can't paste a password into the Google sign-in page.

This follows the approach the same function already uses for Cmd+R (reload). The new code is wrapped in #ifdef __APPLE__, so Windows and Linux behave as before.

Related issues

Partially addresses #365. This PR covers browser docks; the Browser Source "Interact" window uses a different code path and is not changed here.

It also covers the dock cases reported in #421 (pasting a password into the YouTube Live Control Panel) and #382 (keyboard copy and paste in the Twitch "Stream Info" dock), which were closed as duplicates of #365.

On the concern raised in #365 that CEF is bad at telling OBS when it has focus: this approach doesn't need OBS to know. OnPreKeyEvent is only called for key events that CEF itself receives, which means the browser view already has keyboard focus. Shortcuts pressed anywhere else in OBS still go to the Edit menu as before.

How Has This Been Tested?

  • Built OBS Studio master with this change on macOS 27.0.1, Apple M4, Xcode 27.1.
  • Added a custom browser dock that loads google.com and focused the search field:
    • Cmd+V pastes the clipboard. Without this change, nothing happens.
    • Cmd+A followed by Cmd+X selects and cuts the text.
    • Cmd+Z restores it.
  • I did not test on Windows or Linux, since the change is macOS-only.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

🤖 Generated with Claude Code

On macOS, CEF relies on the application's Edit menu to send the
standard editing selectors (cut:, copy:, paste:, selectAll:, undo:,
redo:) to the focused browser view. OBS's Edit menu uses its own
actions instead, so Cmd+V and the other editing shortcuts do nothing
in browser docks, e.g. when pasting a password into the YouTube Live
Control Panel sign-in page.

Handle these shortcuts in OnPreKeyEvent, as is already done for Cmd+R,
and forward them to the focused frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants