Making NSSegmentedControl segments accessible - accessibility

My AppKit app's NSSegmentedControl doesn't show any labels in the Accessibility Inspector, meaning that disabled users won't be able to use assistive devices to interact with them. Calling setAccessibilityLabel and setAccessibilitySelected on the segment controls has no effect.
Similar advice on the topic (e.g., Disable / hide accessibility element) says to use accessibilitySetOverrideValue, which does work, but it is deprecated:
accessibilitySetOverrideValue(_:forAttribute:)' was deprecated in macOS 10.10: Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)
The Apple docs at https://developer.apple.com/documentation/objectivec/nsobject/1535843-accessibilitysetoverridevalue read:
This method is deprecated. Use the new method-based API instead. For more information, see Accessibility Programming Guide for OS X or NSAccessibilityProtocol.
However, there doesn't seem to be any equivalent method to override an accessibility value. How can I accomplish this without using deprecated methods?

NSSegmentedControl will pick up the accessibilityDescription of the image. So the solution I used was to ensure all my segmented controls have images, and for each one, if necessary, make a copy of the image, set the accessibilityDescription explicitly, and reset the image.
Ugly, but better than any other solution I found.

Related

Mpdf - How to set font size before writeCell?

I want to highlight the fact that I am using programmatically mPdf to do some specific writeText / writeCell, etc..
I need to simply increase font size when writing a specific text. Only for this.
How?
There is actually a public method for that, named SetFont. The problem with it is that it is completely undocumented, so it is unclear whether you’re actually supposed to use it, or it’s just an unstable implementation detail.
The documented API to accomplish this is to specify fonts and all other formatting information using HTML/CSS and then use the WriteHTML or WriteFixedPosHTML method to pass that to the mPDF library.

What is the purpose of user interface module in css3?

I am trying to gain knowledge of CSS3 so I know user interface module, it provides a bunch of properties in that has resize property, but I dont know why it has resize property that allow user to change size of elements.In addition to that I have no idea of what is purpose of user interface module is used for.
so I hope someone can answer this to me.
very thanks.
CSS Basic User Interface Module Level 3 (CSS3 UI) by Tantek Çelik and Florian Rivoal (editors), W3C candidate recommendation of 2 March 2017, has the following to say:
The purpose of this specification is to achieve the following objectives: extend the user interface features in CSS2.1; provide additional CSS mechanisms to augment or replace other dynamic presentation related features in HTML; introduce directional navigation properties to assist in the construction of user interfaces which make use of a directional navigation model.
Please note that a styling property does not become instantly available in all browsers just because the W3C published a candidate recommendation. You should check that you can actually use the properties described in the document. Can I Use comes to mind.
As far as I can tell the specification provides some nice tools for styling interactive HTML documents, such as web-based applications. For example, it allows drawing outlines around objects, modifying the shape of the mouse cursor and other such goodies. Whether you want to use them or not, and indeed whether you can use them or not depends on your design and your target audience.
As to "why it has resize property": because it exists in some browsers. In this case the W3C just documents and standardizes an already existing technology.

Using the firefox-addon SDK panel module without the boxed look

I would like to use the panel module (i.e. attach not only script but also html and CSS and not have the addon CSS and JavaScript potentially interact with that of the main page) but not have the restraints of the boxed look. It seems like this ought to be fairly simple, but the only way I see to do this is to use the low lying APIs which lack much of the simplicity, security and documentation of the high level apis.
Use one of the following:
Stylesheet Service
UserChrome.css
UserChrome.js
UserChrome.js Extension
Resource Aliases

Best practices for identifiers/classes names in browser extensions

In extensions (I'm praticularly focused on Chrome's extensions), css identifiers and classes injected in a page may enter in conflict with other elements on the page.
I'm trying to define their name with an extension prefix, but it's not perfectly sure. So, is there a way to define scurely names of css ids/classes?
It's not possible if "perfectly sure" is your requirement. Someone could always download your extension, look at the classnames you're using, then change their website's CSS to conflict with (or more likely attempt to override) your classnames. This is a feature, not a bug; extensions extend web pages, so they're supposed to be able to commingle with and alter their DOMs.
If you wanted to invent a system where others would not intentionally conflict with yours, why not use the Java namespace scheme: take a domain you own, and use it as a prefix, like com-example-myclassname? Slightly less readable and no more secure would be either the ID of your extension or a randomly generated SHA-1 hexcoded hash:
abcdefghijklmnop-myclassname
da39a3ee5e6b4b0d3255bfef95601890afd80709-myclassname
I'm intentionally not including dynamic solutions here because CSS typically isn't dynamic in a Chrome extension or app. Moreover, CSP would probably make this approach anything but straightforward (which is a good thing).

How well are the CSS2 'system colors' supported?

I've been reading the CSS2 spec in my spare time, and I've come across this. The note states that the system colours are deprecated, however, what is the browser support for the system colours part of the spec like?
This feature is deprecated. (it says so at the top of the link you provided)
It is not well supported, and is likely to get less so over time.
The intention of this feature was to provide the browser with access to the colour scheme of the underlying desktop operating system. However it has been dropped for several reasons. Desktop operating systems don't all have the same features, and furthermore the features they do have are open to change.
Finally, the main reason it was dropped is because the underlying reason for having them was to allow site designers to make their sites look like they belong to the parent OS. However there are other, better ways to achieve this now (notwithstanding the fact that most web site designers seem to prefer to have a consistent look and feel to their site that isn't dictated by the user).
See http://www.w3.org/TR/2003/CR-css3-color-20030514/#css-system for up-to-date info on this. At the bottom of this section is the following note:
The CSS2 System Color values have been deprecated in favor of the CSS3 UI 'appearance' property for specifying the complete look of user interface related elements.
That should help tell you where to look for an up-to-date method of achieving a similar result.
The set of colours specified by the W3C in this page is roughly equivalent to the colour scheme values available in Windows 2000. This is obviously of limited use to someone running Windows XP, and no use at all to a Vista or Win7 user, let alone a Mac or Linux user.
i dont know what the support in different browsers for these values looks like, but you can test it for yourself by designing a small page using these, uploading it and testing it with
Browsershot

Resources