javascriptgoogle-chrome-extensiongmailcontent-scriptinboxsdk

InboxSDK `registerComposeViewHandler` not firing for **inline** replies (works only when reply is popped out)


I’m building a Chrome extension for Gmail using InboxSDK v2. My registerComposeViewHandler works perfectly when I click Pop out reply (the floating compose window), but it never fires for an inline reply inside a thread.

Per the docs, sdk.Compose.registerComposeViewHandler should be called whenever a compose view is created — including inline replies: https://inboxsdk.github.io/inboxsdk-docs/compose/

Minimal repro (content script)

// content.js
(function() {
  InboxSDK.load(2, 'sdk_xxx').then((sdk) => {
    console.log('SDK ready');

    // Register once, immediately
    sdk.Compose.registerComposeViewHandler((composeView) => {
      console.log('ComposeView detected') // Never logged if inline reply
    });
  });
})();

Manifest excerpt

{
  "manifest_version": 3,
  "name": "My Extension",
  "version": "1.0.0",
  "permissions": [],
  "host_permissions": ["https://mail.google.com/*"],
  "content_scripts": [
    {
      "matches": ["https://mail.google.com/*"],
      "js": ["content.js"],
      "run_at": "document_end"   // also tried "document_start"
    }
  ],
  "web_accessible_resources": [{
    "resources": ["*"],
    "matches": ["https://mail.google.com/*"]
  }]
}

What I expect

What actually happens

What I’ve tried

Is there a known quirk where inline replies don’t emit registerComposeViewHandler under certain conditions? Do I need a different event hook for inline replies, or to wait for a specific Gmail state before they’re detectable?

Any pointers or a working inline-reply repro would be appreciated.


Solution

  • Update "@inboxsdk/core" npm package to : "^2.2.8",