Skip to content

fix: home drawer keyboard focus trap [WPB-14804]#4907

Open
Garzas wants to merge 2 commits into
developfrom
fix/home-drawer-keyboard-focus-trap
Open

fix: home drawer keyboard focus trap [WPB-14804]#4907
Garzas wants to merge 2 commits into
developfrom
fix/home-drawer-keyboard-focus-trap

Conversation

@Garzas
Copy link
Copy Markdown
Contributor

@Garzas Garzas commented Jun 2, 2026

https://wearezeta.atlassian.net/browse/WPB-14804


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Fixed issues:

  • When the home hamburger menu was open, keyboard focus could still move to hidden background content.
  • The drawer could not be reliably closed with keyboard navigation.
  • Drawer keyboard navigation did not stay inside the drawer items and could expose hidden or stale focused drawer content.
  • An empty spacer area inside the drawer could receive focus.

Causes

The home drawer stayed composed while closed and relied mostly on default Compose focus traversal. This allowed hidden drawer content and background screen content to remain reachable depending on focus state.

The drawer item list also had no explicit forward/backward focus loop, and the spacer between top and bottom drawer items could become a focus target.

Solutions

  • Added explicit drawer focus handling and focus requesters for first/last drawer items.
  • Trapped keyboard focus inside the drawer while it is open.
  • Wrapped drawer item traversal so TAB from the last item returns to the first item, and SHIFT+TAB works in reverse.
  • Added ESC/Back handling to close the drawer from keyboard navigation.
  • Hid background screen semantics and focusability while the drawer is open.
  • Disabled drawer item click/focus semantics while the drawer is closed to avoid stale hidden focus.
  • Removed the focusable empty drawer spacer.
  • Split drawer/scaffold keyboard focus logic out of HomeScreen.kt into HomeScaffold.kt to keep the screen file smaller and easier to review.

@Garzas Garzas requested review from saleniuk and yamilmedina June 2, 2026 07:14
@Garzas Garzas self-assigned this Jun 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 0% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.24%. Comparing base (4227187) to head (f2d40e5).

Files with missing lines Patch % Lines
...in/kotlin/com/wire/android/ui/home/HomeScaffold.kt 0.00% 62 Missing ⚠️
...tlin/com/wire/android/ui/home/drawer/HomeDrawer.kt 0.00% 9 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4907      +/-   ##
===========================================
- Coverage    50.40%   50.24%   -0.17%     
===========================================
  Files          626      628       +2     
  Lines        22192    22263      +71     
  Branches      3427     3440      +13     
===========================================
  Hits         11186    11186              
- Misses        9969    10040      +71     
  Partials      1037     1037              
Files with missing lines Coverage Δ
...tlin/com/wire/android/ui/home/drawer/HomeDrawer.kt 0.00% <0.00%> (ø)
...in/kotlin/com/wire/android/ui/home/HomeScaffold.kt 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4227187...f2d40e5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant