setMacroJsOverride not overriding when inserting with wiki markup

I’m trying to create a custom dialog for my macros to configure them. When inserting a macro via the macro browser (In the top menu “+” -> “other macros”), my custom dialog will show up. However when adding them via wiki markup ("{my-button") and choosing the macro from the suggestions, nothing will happen.

Here’s a minimal version of my code that should run according to other posts, but it only works when using the regular macro browser (the alert will show up), however no alert will be shown when inserting the macro using the wiki markup.

Any suggestions?

AJS.MacroBrowser.setMacroJsOverride("my-button", {
      opener: function(macro) {
        alert("This alert shows when using the macro browser but not when using wiki markup");
        var macro = {
          name: "my-button",
          params: { label: "hi", background: "green", color: "red" }
        };
        tinymce.confluence.macrobrowser.macroBrowserComplete(macro);
      }
    });