[DON-3492] Add accessibility label to BPKBannerAlert - #2785
[DON-3492] Add accessibility label to BPKBannerAlert#2785Jasper Sion (jaspersion05) wants to merge 4 commits into
Conversation
Generated by 🚫 Danger Kotlin against a2c7415 |
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds support for a separate accessibility label for the icon in BpkBannerAlert, allowing custom icons to have their own contentDescription (with a fallback to alertTypeContentDescription).
Changes:
- Added optional
iconContentDescription: String? = nulltoBpkBannerAlertandBpkBannerAlertImpl, used for the icon’scontentDescriptionwith a fallback behavior. - Updated BannerAlert Compose docs with a new usage example for a custom icon accessibility label.
- Added new Compose accessibility tests for explicit and fallback content descriptions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/compose/BannerAlert/README.md | Documents the new iconContentDescription parameter with an example. |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/banneralert/BpkBannerAlert.kt | Exposes the new optional API parameter and threads it through. |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/banneralert/internal/BpkBannerAlertImpl.kt | Applies iconContentDescription to the rendered icon with fallback logic. |
| backpack-compose/src/androidTest/kotlin/net/skyscanner/backpack/compose/banneralert/BpkBannerAlertAccessibilityTest.kt | Adds coverage for explicit icon description and fallback behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ``` | ||
|
|
||
| Example of a BannerAlert with a custom icon and its own accessibility label: | ||
|
|
| import androidx.compose.ui.test.onNodeWithContentDescription | ||
| import net.skyscanner.backpack.compose.icon.BpkIcon | ||
| import net.skyscanner.backpack.compose.theme.BpkTheme | ||
| import net.skyscanner.backpack.compose.tokens.Airline |
| icon = iconFinal, | ||
| tint = tint, | ||
| contentDescription = alertTypeContentDescription, | ||
| contentDescription = iconContentDescription ?: alertTypeContentDescription, |
… scope in BannerAlert docs
Generated by 🚫 Danger Kotlin against 424ccb0 |
Summary
Adds
accessibilityLabelsupport for the custom icon inBpkBannerAlert, closing the gap identified by the parity audit — previously there was no way to set a custom content description for the icon separate from the banner'salertTypeContentDescription.Changes
iconContentDescription: String? = nulltoBpkBannerAlertandBpkBannerAlertImpl, threaded through to the icon'scontentDescription.iconContentDescription ?: alertTypeContentDescription, preserving existing behaviour when the new parameter isn't supplied.docs/compose/BannerAlert/README.mdwith a usage example showing a custom icon paired with its own accessibility label.BpkBannerAlertAccessibilityTest.ktcovering both the expliciticonContentDescriptioncase and the fallback-to-alertTypeContentDescriptioncase, following the existingBpkCellItemAccessibilityTest.ktconvention.Compatibility
Source- and binary-compatible. The new parameter is appended last and defaults to
null. All existing call sites in this repo and inskyscanner-app(Origami, Wasabi) use named arguments only, so none are affected.Verification
Remember to include the following changes:
README.mdIf you are curious about how we review, please read through the code review guidelines