feat: improve TouchBarButton accessibility (#20454)

This commit is contained in:
Shelley Vohr 2019-10-08 17:13:57 +02:00 committed by John Kleinschmidt
parent 8da9a3c416
commit c16a186de0
4 changed files with 53 additions and 32 deletions

View file

@ -8,16 +8,23 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
* `options` Object
* `label` String (optional) - Button text.
* `accessibilityLabel` String (optional) - A short description of the button for use by screenreaders like VoiceOver.
* `backgroundColor` String (optional) - Button background color in hex format,
i.e `#ABCDEF`.
* `icon` [NativeImage](native-image.md) | String (optional) - Button icon.
* `iconPosition` String (optional) - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
* `click` Function (optional) - Function to call when the button is clicked.
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
### Instance Properties
The following properties are available on instances of `TouchBarButton`:
#### `touchBarButton.accessibilityLabel`
A `String` representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.
#### `touchBarButton.label`
A `String` representing the button's current text. Changing this value immediately updates the button

View file

@ -8,8 +8,11 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
* `options` Object
* `label` String (optional) - Text to display.
* `accessibilityLabel` String (optional) - A short description of the button for use by screenreaders like VoiceOver.
* `textColor` String (optional) - Hex color of text, i.e `#ABCDEF`.
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
### Instance Properties
The following properties are available on instances of `TouchBarLabel`:
@ -19,6 +22,10 @@ The following properties are available on instances of `TouchBarLabel`:
A `String` representing the label's current text. Changing this value immediately updates the label in
the touch bar.
#### `touchBarLabel.accessibilityLabel`
A `String` representing the description of the label to be read by a screen reader.
#### `touchBarLabel.textColor`
A `String` hex code representing the label's current text color. Changing this value immediately updates the