xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

[macos] Multiple Accessibility APIs missing #5019

Open chamons opened 6 years ago

chamons commented 6 years ago

This code works in ObjC:

    NSPopUpButton *p = [[NSPopUpButton alloc] init];
    p.accessibilityIdentifier = @"hello";
    NSString *result = p.accessibilityIdentifier;

But this does not in C#:

NSPopUpButton button = new NSPopUpButton ();
button.AccessibilityIdentifier = "hello";
var result = button.AccessibilityIdentifier;

It comes off the full set in:

@protocol NSAccessibility <NSObject>
@required
chamons commented 6 years ago

NSButton has NSControl which has NSAccessibility so it should have a get and set, but it doesn’t, might be a generator bug. At first glance the bindings look right.

spouliot commented 6 years ago

@chamons which branch ? Bindings for NSControl does not implement NSAccessibility protocol in stable (15.8 / xcode10.1)

spouliot commented 6 years ago

So things are a bit different than XI.

NSAccessibilityElementProtocol defines as a getter only, while NSAccessibility defines it with a getter and setter. Both are applied to NSView (from which all controls gets this).

chamons commented 6 years ago

Yeah, sorry for the delay, it gets it from NSView:

https://github.com/xamarin/xamarin-macios/blob/master/src/appkit.cs#L4674 https://github.com/xamarin/xamarin-macios/blob/master/src/appkit.cs#L15291