Skip to content

fix(command-line): hide Ctrl/Cmd + Shift + P hint on Firefox (@d1rshan)#7690

Open
d1rshan wants to merge 1 commit intomonkeytypegame:masterfrom
d1rshan:fix/firefox-command-line-keybind
Open

fix(command-line): hide Ctrl/Cmd + Shift + P hint on Firefox (@d1rshan)#7690
d1rshan wants to merge 1 commit intomonkeytypegame:masterfrom
d1rshan:fix/firefox-command-line-keybind

Conversation

@d1rshan
Copy link

@d1rshan d1rshan commented Mar 20, 2026

Summary

Hide the Cmd/Ctrl + Shift + P shortcut on Firefox, where it is reserved for private windows and not usable by the app.

Changes

  • Hide Cmd/Ctrl + Shift + P from command palette hints on Firefox
  • Show only available shortcuts (e.g. Esc) in:
    • Footer
    • Settings
    • About

Notes

UI-only change. No changes to keybind logic.

Testing

  • Verified in Firefox: shortcut is hidden and only Esc is shown
  • Verified in Chrome: shortcut is still displayed

Closes #7689

Copilot AI review requested due to automatic review settings March 20, 2026 09:13
@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Mar 20, 2026
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Mar 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts frontend UI shortcut hints to avoid advertising Ctrl/Cmd + Shift + P on Firefox, where that shortcut is reserved by the browser and can’t be used reliably for opening Monkeytype’s command line.

Changes:

  • Hide Ctrl/Cmd + Shift + P in shortcut hint text when running on Firefox.
  • Continue showing the Esc/Tab (depending on quick restart setting) hint in Settings, Footer keytips, and About page.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
frontend/src/ts/pages/settings.ts Updates Settings tip HTML to omit the Ctrl/Cmd + Shift + P hint on Firefox.
frontend/src/ts/components/pages/AboutPage.tsx Updates About page “keybinds” copy to conditionally omit the Ctrl/Cmd + Shift + P hint on Firefox.
frontend/src/ts/components/layout/footer/Keytips.tsx Updates footer keytips to conditionally omit the Ctrl/Cmd + Shift + P hint on Firefox.

Comment on lines 8 to 13
const userAgent = window.navigator.userAgent.toLowerCase();
const modifierKey =
userAgent.includes("mac") && !userAgent.includes("firefox")
? "cmd"
: "ctrl";
const isFirefox = userAgent.includes("firefox");
const modifierKey = userAgent.includes("mac") && !isFirefox ? "cmd" : "ctrl";

const commandKey = (): string =>
getConfig.quickRestart === "esc" ? "tab" : "esc";
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

isFirefox/modifierKey user-agent parsing is duplicated across this PR (also in settings.ts/AboutPage.tsx). Consider extracting a small shared helper (e.g., utils/browser or utils/shortcuts) so future browser/platform tweaks only need changing in one place.

Copilot uses AI. Check for mistakes.
Comment on lines 731 to +733
qs(".pageSettings .tip")?.setHtml(`
tip: You can also change all these settings quickly using the
command line (<kbd>${commandKey}</kbd> or <kbd>${modifierKey}</kbd> + <kbd>shift</kbd> + <kbd>p</kbd>)`);
command line (${isFirefox ? `<kbd>${commandKey}</kbd>` : `<kbd>${commandKey}</kbd> or <kbd>${modifierKey}</kbd> + <kbd>shift</kbd> + <kbd>p</kbd>`})`);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The setHtml template literal now contains a nested ternary with nested template literals, which is hard to scan/maintain. Consider building the shortcut hint string in a variable first, then interpolating it into the final setHtml call.

Copilot uses AI. Check for mistakes.
Comment on lines 21 to +25
export function AboutPage(): JSXElement {
const isOpen = () => getActivePage() === "about";
const isFirefox = window.navigator.userAgent
.toLowerCase()
.includes("firefox");
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Browser detection via window.navigator.userAgent.toLowerCase().includes("firefox") is now repeated in multiple UI files in this PR. Consider centralizing it in a shared helper to avoid drift/inconsistent behavior over time.

Suggested change
export function AboutPage(): JSXElement {
const isOpen = () => getActivePage() === "about";
const isFirefox = window.navigator.userAgent
.toLowerCase()
.includes("firefox");
const isFirefoxBrowser = (): boolean =>
typeof window !== "undefined" &&
window.navigator.userAgent.toLowerCase().includes("firefox");
export function AboutPage(): JSXElement {
const isOpen = () => getActivePage() === "about";
const isFirefox = isFirefoxBrowser();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firefox: Cmd/Ctrl + Shift + P shown in UI but not usable

3 participants