Skip to content

[DON-3492] Add accessibility label to BPKBannerAlert - #2785

Open
Jasper Sion (jaspersion05) wants to merge 4 commits into
mainfrom
donburi/DON-3491-Add-accessibility-label-BannerAlert
Open

[DON-3492] Add accessibility label to BPKBannerAlert#2785
Jasper Sion (jaspersion05) wants to merge 4 commits into
mainfrom
donburi/DON-3491-Add-accessibility-label-BannerAlert

Conversation

@jaspersion05

Copy link
Copy Markdown
Contributor

Summary

Adds accessibilityLabel support for the custom icon in BpkBannerAlert, 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's alertTypeContentDescription.

Changes

  • Added a new optional trailing parameter iconContentDescription: String? = null to BpkBannerAlert and BpkBannerAlertImpl, threaded through to the icon's contentDescription.
  • The icon's content description now resolves as iconContentDescription ?: alertTypeContentDescription, preserving existing behaviour when the new parameter isn't supplied.
  • Documented the new parameter in docs/compose/BannerAlert/README.md with a usage example showing a custom icon paired with its own accessibility label.
  • Added BpkBannerAlertAccessibilityTest.kt covering both the explicit iconContentDescription case and the fallback-to-alertTypeContentDescription case, following the existing BpkCellItemAccessibilityTest.kt convention.

Compatibility

Source- and binary-compatible. The new parameter is appended last and defaults to null. All existing call sites in this repo and in skyscanner-app (Origami, Wasabi) use named arguments only, so none are affected.

Verification

  • New accessibility tests added and pass locally.
  • No visual/behavioural change for existing callers, so no snapshot re-recording was needed.

Remember to include the following changes:

  • README.md
  • Tests
  • Screenshotting code
  • Adding a component? Remember to expose it in the main header/index if applicable

If you are curious about how we review, please read through the code review guidelines

Copilot AI lite review requested due to automatic review settings August 13, 2026 10:41
@jaspersion05 Jasper Sion (jaspersion05) added the minor A new & backwards compatible feature/component label Aug 13, 2026
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor
Warnings
⚠️ One or more component files were updated, but the tests weren't updated. If your change is not covered by existing tests please add snapshot tests.
⚠️

One or more component files were updated, but the docs screenshots weren't updated. If the changes are visual or it is a new component please regenerate the screenshots via ./gradlew recordScreenshots.

Generated by 🚫 Danger Kotlin against a2c7415

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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? = null to BpkBannerAlert and BpkBannerAlertImpl, used for the icon’s contentDescription with 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,
@jaspersion05 Jasper Sion (jaspersion05) changed the title [DON-3491] Add accessibility label to BPKBannerAlert [DON-3492] Add accessibility label to BPKBannerAlert Aug 18, 2026
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor
Warnings
⚠️ One or more component files were updated, but the tests weren't updated. If your change is not covered by existing tests please add snapshot tests.
⚠️

One or more component files were updated, but the docs screenshots weren't updated. If the changes are visual or it is a new component please regenerate the screenshots via ./gradlew recordScreenshots.

Generated by 🚫 Danger Kotlin against 424ccb0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor A new & backwards compatible feature/component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants