Panel Submenus show MacOS system services
-
Some Panels show the MacOS "AutoFill" service at the bottom of the hamburger Submenu.
Not consistently, and not everywhere.
It seems to depend on whether an input field in the panel has focus - which makes sense...Not a big deal, but seldomly relevant.
BR/ Lars Herold
VS 1.2.030
Mac mini M2 Pro
Mac OS Sonoma 14.5
-
@larsherold Interesting, this seems to be something added by MacOS automatically (maybe an accessibility feature).
I will open a bug on this, to try to find out more.
-
@VectorStyler Yes, I'm not a coder, but it may be an API-feature of sorts.
Previously only a Safari thing, but now available in most/all desktop apps in the Edit menu, active when the caret is placed in an input field.. Lets you pick and enter name, address and so on from contacts or enter passwords from the keychain.BR Lars Herold
-
A robot friend says this - may help, may not:
To fix unexpected autofill or contacts in macOS context menus using C++ and Objective-C++, check these areas:
-
Context Menu Implementation:
- Ensure menus only show relevant items for the context.
-
Event Handling:
- Verify correct handling of right-click events.
-
Input Field Attributes:
- Disable unwanted autofill attributes (e.g.,
autocomplete="off"
).
- Disable unwanted autofill attributes (e.g.,
-
Custom Menu Items:
- Remove unwanted system items and ensure custom items are properly defined.
-
Debugging and Logging:
- Add logs to trace unwanted menu additions.
- Use
Xcode Instruments
for profiling.
-
Frameworks and Libraries:
- Check third-party libraries for side effects.
- Update to latest versions.
Here is an example of how to implement a context menu in C++ with Objective-C++:
// ViewController.h
#import <Cocoa/Cocoa.h>@interface ViewController : NSViewController <NSMenuDelegate>
@end// ViewController.mm
#import "ViewController.h"@implementation ViewController
-
(void)viewDidLoad {
[super viewDidLoad];NSMenu *menu = [[NSMenu alloc] initWithTitle:@"Context Menu"];
[menu setDelegate:self];NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@"Custom Action"
action:@selector(customAction)
keyEquivalent:@""];
[menu addItem:menuItem];[self.view setMenu:menu];
} -
(void)customAction {
// Handle custom action
} -
(void)menuNeedsUpdate:(NSMenu *)menu {
[menu removeAllItems];
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@"Dynamic Action"
action:@selector(customAction)
keyEquivalent:@""];
[menu addItem:menuItem];
}
@end
// main.cpp
#include <Cocoa/Cocoa.h>int main(int argc, const char * argv[]) {
return NSApplicationMain(argc, argv);
}In this example,
ViewController
implements theNSMenuDelegate
protocol to dynamically update the context menu. ThemenuNeedsUpdate:
method ensures that the context menu only contains relevant items. This example combines C++ (inmain.cpp
) with Objective-C++ (inViewController.mm
), which is commonly used in macOS development.
-