Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save calebhailey/74a770a88c80c62f461060cdfab40a26 to your computer and use it in GitHub Desktop.
Save calebhailey/74a770a88c80c62f461060cdfab40a26 to your computer and use it in GitHub Desktop.

Hi there 👋 I'm a newbie to the Apple Developer ecosystem. I recently shipped my very first app to the App Store (see: https://themagichighlighter.com, or check it out on the App Store for more info).

Here's an excerpt from my manifest.json file, with the corresponding action and commands configuration:

{
    "...": "...",
    "action": {
        "default_popup": "popup.html",
        "browser_style": true,
        "default_area": "navbar",
        "default_icon": {
            "16": "images/toolbar-icon-16.png",
            "19": "images/toolbar-icon-19.png",
            "32": "images/toolbar-icon-32.png",
            "38": "images/toolbar-icon-38.png",
            "48": "images/toolbar-icon-48.png",
            "72": "images/toolbar-icon-72.png"
        }
    },
    "commands": {
      "_execute_action": {
        "suggested_key": {
          "default": "Ctrl+Shift+F",
          "mac": "Ctrl+Shift+F",
          "ios": "Ctrl+Shift+F"
        },
        "description": "Open the popup menu"
      }
    },
}

Everything basically works as expected. The ⌘-Shift-F keyboard shortcut opens the extension popup on Mac and iPad (w/ external keyboard attached), and on Safari for Mac the popup has focus so it can accept subsequent keyboard input.

I can even see the commands._execute_action.description in the iPadOS keyboard shortcut menu (long press the ⌘ key and use → to see "Safari Extensions" shortcuts). Cool!

However, on the iPad the popup doesn't have focus so it can't receive subsequent keyboard input. I've even tried using document.activeElement = *** in the popup to force focus, AND element.blur() in the active tab to forcefully remove focus, but none of it works on iPad.

Any suggestions would be greatly appreciated!!

Cheers 🍻

@calebhailey
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment