Skip to content

feat(pass-extension): add autofill keyboard shortcut command#481

Open
yuribodo wants to merge 5 commits intoProtonMail:mainfrom
yuribodo:feat/autofill-keyboard-shortcut
Open

feat(pass-extension): add autofill keyboard shortcut command#481
yuribodo wants to merge 5 commits intoProtonMail:mainfrom
yuribodo:feat/autofill-keyboard-shortcut

Conversation

@yuribodo
Copy link
Copy Markdown

Summary

Adds a keyboard shortcut to trigger autofill in the Proton Pass browser extension, as discussed and approved in #453.

  • Registers a new autofill command in Chrome and Firefox manifests with Ctrl+Shift+U as the default shortcut
  • Handles the command in the background script by sending an AUTOFILL_TRIGGER message to the active tab's content script
  • Content script finds the first detected login field and opens the autofill dropdown, reusing the existing inline dropdown flow

Closes #453

Changes

File Change
manifest-chrome.json Added "autofill" command entry
manifest-firefox.json Added "autofill" command entry
src/types/messages.ts Added AUTOFILL_TRIGGER to WorkerMessageType enum
src/lib/extension/commands.ts Added async handler for the "autofill" command
src/lib/extension/commands.spec.ts Added 4 unit tests for command handling
src/app/content/services/autofill/autofill.service.ts Registered AUTOFILL_TRIGGER handler using withContext pattern

How it works

  1. User presses Ctrl+Shift+U
  2. browser.commands.onCommand fires in the background script
  3. Background queries the active tab and sends AUTOFILL_TRIGGER via browser.tabs.sendMessage
  4. Content script's FrameMessageBroker receives the message
  5. Handler finds the first field with DropdownAction.AUTOFILL_LOGIN via formManager.getFields()
  6. Opens the autofill dropdown on that field using inline.dropdown.toggle()
  7. User selects credentials → normal autofill flow proceeds

If no login field is detected on the page, the shortcut is a no-op.

Design decisions

Default shortcut Ctrl+Shift+U: Chosen to avoid conflicts with existing commands (Ctrl+Shift+X for popup, Ctrl+Shift+L for larger window). The industry standard for autofill is Ctrl+Shift+L (used by Bitwarden and LastPass). If the team is open to it, reassigning Ctrl+Shift+L from open-larger-window to autofill in a follow-up would align with user expectations from competing password managers.

Dropdown approach (not direct autofill): Opens the dropdown instead of auto-filling the top match. This is safer, gives the user control when multiple credentials match, and reuses the existing dropdown infrastructure with minimal new code.

Safari excluded: Safari does not support the browser.commands API. The command listener is already gated by BUILD_TARGET !== 'safari' in worker/index.ts.

Test plan

  • Unit tests for handleExtensionCommand (4 tests passing):
    • Opens larger window for open-larger-window command
    • Sends AUTOFILL_TRIGGER to active tab for autofill command
    • Does not send message when no active tab is found
    • Does nothing for unknown commands
  • Manual: press Ctrl+Shift+U on a login page → dropdown opens on first login field
  • Manual: press Ctrl+Shift+U on a page with no login form → nothing happens
  • Manual: verify Ctrl+Shift+X and Ctrl+Shift+L still work as before
  • Manual: verify new shortcut appears in Settings → Shortcuts

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.

Proton Pass Web Extension - Autofill keyboard shortcut contribution

1 participant