Skip to content

[DON-3563] Add contentDescription to BpkSearchInputControl - #2786

Merged
peterliu (peterInTown) merged 3 commits into
mainfrom
DON-3563-add-contentdescription-to-SearchInputControl
Aug 19, 2026
Merged

[DON-3563] Add contentDescription to BpkSearchInputControl#2786
peterliu (peterInTown) merged 3 commits into
mainfrom
DON-3563-add-contentdescription-to-SearchInputControl

Conversation

@peterInTown

Copy link
Copy Markdown
Contributor

Summary

  • Adds a required contentDescription parameter to BpkSearchInputControl / BpkControlFieldImpl, so the field's accessible label can be set explicitly.
  • Uses clearAndSetSemantics on the control field's Box so TalkBack announces a single, explicit description instead of a merged one built from child nodes (prefix, value, placeholder).
  • Updates SearchInputControlStory demo call sites with example descriptions.

Test plan

  • Run the app and verify SearchInputControlDockedStack renders correctly
  • Enable TalkBack and confirm each search input field announces only the intended contentDescription

Uses clearAndSetSemantics on the control field so TalkBack announces a single, explicit description instead of a merged one built from child nodes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 10:22
@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.

⚠️

One or more component files were updated, but README.md wasn't updated. If your change contains API changes/additions or a new component please update the relevant component README.

Generated by 🚫 Danger Kotlin against c217653

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 an explicit accessibility label to BpkSearchInputControl so TalkBack announces a single, intended description instead of a merged string from child semantics.

Changes:

  • Introduces a required contentDescription parameter on BpkSearchInputControl and threads it into BpkControlFieldImpl.
  • Applies clearAndSetSemantics on the control field container to override merged child semantics.
  • Updates demo story call sites with example content descriptions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/textfield/internal/BpkControlFieldImpl.kt Overrides container semantics to provide a single accessible label.
backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/searchinputcontrol/BpkSearchInputControl.kt Makes contentDescription a required public API param and forwards it to the internal control field.
app/src/main/java/net/skyscanner/backpack/demo/compose/SearchInputControlStory.kt Updates demo usage with example content descriptions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 52 to 56
fun BpkSearchInputControl(
inputText: String,
inputHint: String,
contentDescription: String,
prefix: Prefix,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is fine, there is no useage for SearchInputControl in the main app at the moment

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.

Change label to major please

isFocused = currentFocusedIndex == 0,
style = style,
docking = Docking.Top,
contentDescription = "Departing from London",
isFocused = currentFocusedIndex == 1,
style = style,
docking = Docking.Middle,
contentDescription = "Where to?",
isFocused = currentFocusedIndex == 2,
style = style,
docking = Docking.Middle,
contentDescription = "Leaving on Thurs 9 May, and returning Fri 29 May, 2025",
isFocused = currentFocusedIndex == 3,
style = style,
docking = Docking.Bottom,
contentDescription = "1 adult travelling",

@LokmaneKrizou Lokmane Krizou (LokmaneKrizou) Aug 18, 2026

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.

peterliu (@peterInTown) plus 1 to copilot, we should be using stringResource instead. other stories use stringResource, lets not introduce hardcoded strings

@peterInTown peterliu (peterInTown) added the minor A new & backwards compatible feature/component label Aug 18, 2026

@mldtms mldtms 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.

it's a demo so I guess plan strings are accepted here, so it's okay.

@henrik-sky Henrik Sym (henrik-sky) 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.

The clear action is visually present but inaccessible. BpkControlFieldImpl applies clearAndSetSemantics to the whole field, which hides descendant semantics. I verified this on the running story with BpkClearAction: the X is visible, but the accessibility tree exposes only one clickable/focusable node, Departing from London; there is no Clear departure airport action/node. That prevents TalkBack users from discovering or activating clear. Please preserve/expose the clear-action semantics while retaining the single field label, and avoid wiping caller-provided semantics.

Co-authored-by: Claude <noreply@anthropic.com>
@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.

⚠️

One or more component files were updated, but README.md wasn't updated. If your change contains API changes/additions or a new component please update the relevant component README.

Generated by 🚫 Danger Kotlin against cdc6642

@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.

⚠️

One or more component files were updated, but README.md wasn't updated. If your change contains API changes/additions or a new component please update the relevant component README.

Generated by 🚫 Danger Kotlin against 91f996d

@henrik-sky Henrik Sym (henrik-sky) added major A breaking API change and removed minor A new & backwards compatible feature/component labels Aug 19, 2026

@henrik-sky Henrik Sym (henrik-sky) 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.

Approved as major change

@peterInTown
peterliu (peterInTown) merged commit 2b92a88 into main Aug 19, 2026
21 checks passed
@peterInTown
peterliu (peterInTown) deleted the DON-3563-add-contentdescription-to-SearchInputControl branch August 19, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai: claude major A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants