confirmationDialog: TalkBack's first focus is an "Unlabelled" tap-to-dismiss margin, and the buttons have no role

Open Beginner friendly
#612 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
80/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, swift

Research direction

Both edits land in Layout/Presentation.swift: the tap-to-dismiss Box inside ConfirmationDialogPresentation, and the Box in ConfirmationDialogButton. Read those two composables first and note the modifier order — clearAndSetSemantics { } must precede clickable to strip the margin from the accessibility tree, and clickable needs role: Role.Button. Done means the first TalkBack focus on the open dialog is the title, buttons are announced as "Button", and tapping the margin still dismisses; verify on an emulator with TalkBack enabled.

Written by the indexing model from the issue text.

Description

Environment

  • skip-ui 1.63.0 (the code below is unchanged in 1.66.4), Fuse app, native mode, Material3, TalkBack on an Android 15 emulator

What happens

When a confirmationDialog opens, TalkBack's first focus lands on an element it reads as "Unlabelled". The dialog buttons are then announced without "Button".

.confirmationDialog("Remove Camille?", isPresented: $confirm, titleVisibility: .visible) {
    Button("Remove", role: .destructive) { remove() }
    Button("Cancel", role: .cancel) { }
}

Why

Layout/Presentation.swift, ConfirmationDialogPresentation, adds a 128 dp tap-to-dismiss margin above the sheet:

Box(modifier: Modifier.fillMaxWidth().height(128.dp).clickable(interactionSource: interactionSource, indication: nil, onClick: { isPresented.set(false) }))

A clickable node with no text: TalkBack focuses it first and reads "Unlabelled". ConfirmationDialogButton uses clickable(onClick:) without a role.

Suggested fix

-            Box(modifier: Modifier.fillMaxWidth().height(128.dp).clickable(interactionSource: interactionSource, indication: nil, onClick: { isPresented.set(false) }))
+            Box(modifier: Modifier.fillMaxWidth().height(128.dp).clearAndSetSemantics { }.clickable(interactionSource: interactionSource, indication: nil, onClick: { isPresented.set(false) }))
...
-    Box(modifier: Modifier.fillMaxWidth().requiredHeightIn(min: 60.dp).clickable(onClick: action), contentAlignment: androidx.compose.ui.Alignment.Center) {
+    Box(modifier: Modifier.fillMaxWidth().requiredHeightIn(min: 60.dp).clickable(role: Role.Button, onClick: action), contentAlignment: androidx.compose.ui.Alignment.Center) {

clearAndSetSemantics placed BEFORE clickable removes the margin from the accessibility tree; touch still dismisses, and the sheet keeps its own "Dismiss" action for TalkBack users. The first focus then goes to the title.

Dominant language
Swift
Stars
334
Forks
95
Avg merge
2d 10h
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from skiptools/skip-ui

All issues in skiptools/skip-ui

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.