Maccy icon indicating copy to clipboard operation
Maccy copied to clipboard

Maccy window intermittently loses ability to change cursor focus to textbox

Open clanesf opened this issue 1 year ago • 1 comments

Description: When pushing the Maccy hotkey, the results window opens up but the text box doesn't get focus and as a result the search doesn't work.

This seems to happen out of nowhere and for some reason if I just randomly click a few of the other icons like the speaker settings, vpn menu, etc. I haven't been able to reliably identify any particular application that needs to be clicked, I just click a few of them and it starts working as expected again.

What's strange is that the Maccy popup windows does indeed get the focus. I can tell this because with each character that I type the dropdown box will select the first item that has that letter in it, but the text doesn't actually appear in the text box.

In Preferences, "Avoid taking application focus" on the Advanced tab is unchecked. Has anyone else experienced this?

Other Applications running with icons next to Maccy include Docker, various stats widgets from https://github.com/exelban/stats, VPN and Magnet

clanesf avatar Oct 04 '22 20:10 clanesf

Can you provide more details? What Maccy version you use? What macOS version? What's the output of running defaults read org.p0deje.Maccy in Terminal.app?

p0deje avatar Oct 10 '22 20:10 p0deje

I think i have a similar issue where after triggering the hotkey, using the up/down arrow keys doesn't scroll through the options as i'd expect. usually happens only after i've had maccy on in the background for a while and haven't found a way to reproduce yet. can be fixed by fully closing the app and restarting it

Maccy version 0.24.0

achou11 avatar Oct 31 '22 17:10 achou11

So for me I can still use the arrow keys as expected, it's just that the cursor doesn't go to the input field and so typing something to try to search just results in the it randomly jumping around to whatever entry close in the starts with whatever character you enter.

clanesf avatar Dec 08 '22 08:12 clanesf

That sounds like the menu failed to attach the key listener which should never happen. I still need https://github.com/p0deje/Maccy/issues/473#issuecomment-1273811702 to understand.

p0deje avatar Dec 08 '22 16:12 p0deje

@p0deje - Okay, so I just noticed something and I think this should help you reproduce it. This only happens to me when a webbrowser is open and the cursor on the web page is in the Password text box awaiting input.

If you go to mail.icloud.com and type in your username then move the cursor where you would input your password and hit the hotkey to pull up the menu, the focus of the cursor stays in the password text box on the web page and as a result doesn't filter the search history when you type.

It seems like there is something about the password text box itself that prevents another program from stealing away the focus. I'll bet that this is some kind of security measure to prevent malware from grabbing the focus if you're logging in.

This behavior happens consistently on password fields in both firefox and chrome. Let me know if you're able to reproduce it on your side. Thanks for everything you do here!

Maccy i'm running 0.24.0 (13) - MacOS I'm running Monterey 12.6.1 and here are the outputs of the defaults read org.p0deje.Maccy command

{
    "KeyboardShortcuts_popup" = "{\\"carbonModifiers\\":768,\\"carbonKeyCode\\":9}";
    "NSWindow Frame SUStatusFrame" = "1720 1501 400 134 0 0 3840 2135 ";
    "NSWindow Frame SUUpdateAlert" = "-1270 1572 620 398 -1920 1080 1920 1055 ";
    "NSWindow Frame com.sindresorhus.Preferences.FrameAutosaveName" = "739 229 502 527 0 0 1920 1055 ";
    SUEnableAutomaticChecks = 1;
    SUHasLaunchedBefore = 1;
    SULastCheckTime = "2022-10-12 17:48:44 +0000";
    SUUpdateGroupIdentifier = 109837439;
    WebKitDefaultFontSize = 13;
    WebKitJavaEnabled = 0;
    WebKitJavaScriptEnabled = 0;
    WebKitPluginsEnabled = 0;
    WebKitStandardFont = "-apple-system-font";
    WebKitUserStyleSheetEnabledPreferenceKey = 1;
    WebKitUserStyleSheetLocationPreferenceKey = "/Applications/Maccy.app/Contents/Frameworks/Sparkle.framework/Resources/ReleaseNotesColorStyle.css";
    avoidTakingFocus = 0;
    enabledPasteboardTypes =     (
        "public.tiff",
        "public.utf8-plain-text",
        "public.png",
        "public.file-url"
    );
    history = {length = 42, bytes = 0x62706c69 73743030 a0080000 00000000 ... 00000000 00000009 };
    historySize = 300;
    ignoredPasteboardTypes =     (
        "de.petermaurer.TransientPasteboardType",
        "Pasteboard generator type",
        "com.typeit4me.clipping",
        "com.agilebits.onepassword",
        "net.antelle.keeweb"
    );
    maxMenuItems = 26;
    migrations =     {
        "2020-02-22-history-item-add-copied-at" = 1;
        "2020-02-22-history-item-add-number-of-copies" = 1;
        "2020-04-18-switch-storage-to-core-data" = 1;
        "2020-04-25-allow-custom-ignored-types" = 1;
        "2020-06-19-use-keyboardshortcuts" = 1;
        "2020-09-01-ignore-keeweb" = 1;
        "2021-02-20-allow-to-customize-supported-types" = 1;
        "2021-06-28-add-title-to-history-item" = 1;
        "2021-10-16-remove-dynamic-pasteboard-types" = 1;
        "2022-08-01-rename-suppress-clear-alert" = 1;
    };
    pinTo = top;
    popupPosition = cursor;
    sortBy = lastCopiedAt;
}

clanesf avatar Dec 16 '22 04:12 clanesf

@clanesf Looks like there is something special about password fields. I'm going to push a workaround so that Maccy falls back to "focusless" mode when it can't be focused. Let's see it helps with other edge cases.

p0deje avatar Jan 14 '23 22:01 p0deje