mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
Update BottomAppBar README to have an a11y sections and the correct guidance. Closes #4284
2.1 KiB
2.1 KiB
To help ensure your bottom app bar is accessible to as many users as possible, please be sure to review the following recommendations:
Set -accessibilityLabel
Set an appropriate
accessibilityLabel
to all buttons within the bottom app bar.
Swift
bottomAppBar.floatingButton.accessibilityLabel = "Compose"
let trailingButton = UIBarButtonItem()
trailingButton.accessibilityLabel = "Buy"
bottomAppBar.trailingBarButtonItems = [ trailingButton ]
Objective-C
bottomAppBar.floatingButton.accessibilityLabel = @"Compose";
UIBarButtonItem *trailingButton =
[[UIBarButtonItem alloc] initWithTitle:nil
style:UIBarButtonItemStylePlain
target:self
action:@selector(didTapTrailing:)];
trailingButton.accessibilityLabel = @"Buy";
[bottomAppBar setTrailingBarButtonItems:@[ trailingButton ]];
Set -accessibilityHint
Set an appropriate
accessibilityHint
to all buttons within the bottom app bar.
Swift
bottomAppBar.floatingButton.accessibilityHint = "Create new email"
let trailingButton = UIBarButtonItem()
trailingButton.accessibilityHint = "Purchase the item"
bottomAppBar.trailingBarButtonItems = [ trailingButton ]
Objective-C
bottomAppBar.floatingButton.accessibilityHint = @"Create new email";
UIBarButtonItem *trailingButton =
[[UIBarButtonItem alloc] initWithTitle:nil
style:UIBarButtonItemStylePlain
target:self
action:@selector(didTapTrailing:)];
trailingButton.accessibilityHint = @"Purchase the item";
[bottomAppBar setTrailingBarButtonItems:@[ trailingButton ]];