Skip to content

Quick win: Unify keyboard behavior#8280

Open
0nko wants to merge 17 commits intodevelopfrom
feature/ondrej/unify-keyboard-behavior
Open

Quick win: Unify keyboard behavior#8280
0nko wants to merge 17 commits intodevelopfrom
feature/ondrej/unify-keyboard-behavior

Conversation

@0nko
Copy link
Copy Markdown
Member

@0nko 0nko commented Apr 15, 2026

Task/Issue URL:
https://app.asana.com/1/137249556945/project/715106103902962/task/1213877678474928?focus=true

Description

Unifies the keyboard behavior and focused state across address bar flows, regardless of AI toggle status.

  • When the omnibar is focused on a website (AI toggle OFF), show the DDG logo if the user has no favorites, or favorites if they have them — matching the AI toggle ON behavior
  • Prevent the programmatic URL expansion on focus (short URL → full URL) from triggering autocomplete suggestions
  • Back button correctly dismisses the focused view / autocomplete overlay without navigating back
  • Scrolling favorites or autocomplete lists dismisses the keyboard (browser tab and input screen)
  • Wrap focused view content in NestedScrollView for consistent scroll behavior
  • Preserve the original SERP query when the Duck.ai input screen is cancelled with an empty field (match the non-input-screen flow)
  • Remove the unwanted drop shadow on the focused view / autocomplete overlay visible during keyboard animation

Steps to test this PR

1. AI Toggle OFF, no favourites

  • Ensure AI toggle is OFF and you have no favourites saved
  • Navigate to any website (e.g. example.com)
  • Tap the address bar
  • Expected: DDG logo is shown on the branded overlay background
  • Press back → logo dismisses, stays on the same page

2. AI Toggle OFF, with favourites

  • Ensure AI toggle is OFF and you have favourites saved
  • Navigate to any website
  • Tap the address bar
  • Expected: Favourites grid is shown on the overlay
  • Scroll the favourites list
  • Expected: Keyboard is dismissed, favourites remain visible

3. AI Toggle OFF: autocomplete scroll dismisses keyboard

  • Navigate to any website
  • Tap the address bar, then start typing a query
  • Expected: Autocomplete suggestions appear
  • Scroll the autocomplete list
  • Expected: Keyboard is dismissed
  • Press back → autocomplete is dismissed

4. AI Toggle ON (Input Screen), with favorites

  • Ensure AI toggle is ON
  • Tap the address bar
  • Start typing to show autocomplete suggestions
  • Scroll the autocomplete list
  • Expected: Keyboard is dismissed
  • Clear the text so favourites are shown, scroll them
  • Expected: Keyboard is dismissed

5. AI Toggle ON: empty-field cancel preserves SERP query

  • Ensure AI toggle is ON
  • Run a search (e.g. "cats") so the omnibar shows the query on the SERP
  • Tap the address bar → input screen opens pre-filled with "cats"
  • Clear the text so the field is empty
  • Press back to return to the browser
  • Expected: Omnibar still shows "cats" (original query restored, not empty)
  • Repeat on a regular website: tap address bar, clear, press back → omnibar still shows the URL

6. No shadow on focused view / autocomplete during keyboard animation

  • AI toggle OFF
  • Navigate to any website
  • Tap the address bar and observe the focused overlay as the keyboard animates in
  • Expected: No horizontal drop shadow visible at the bottom edge of the overlay while the keyboard is sliding
  • Type a query so autocomplete appears, then dismiss (press back) and observe the keyboard animating out
  • Expected: No shadow visible at the bottom edge of the autocomplete list during the animation

UI changes

Screen_recording_20260415_101618.webm
Screen_recording_20260415_100831.webm
Screen_recording_20260415_095005.webm

Note

Medium Risk
Touches omnibar focus/autocomplete state decisions and back/scroll event handling across browser and Duck.ai input screens, which can regress navigation or suggestion visibility if edge cases are missed.

Overview
Unifies the omnibar focused overlay behavior by replacing showFavorites with showFocusedView, showing the focused overlay for URL-focused/empty-query browsing (including SERP prefill) and displaying the DDG logo when there are no favorites.

Prevents programmatic URL/query prefill changes on focus from triggering autocomplete suggestions, and adjusts the omnibar back-key handling to return whether an overlay was dismissed (so back closes focused/autocomplete overlays without navigating).

Improves keyboard dismissal consistency by hiding the keyboard when users scroll autocomplete/focused/favorites content (browser tab and Duck.ai input screen), wraps the focused overlay content in a NestedScrollView, avoids overwriting SERP/NTP draft text with empty strings, and removes overlay drop shadows via android:outlineProvider="none".

Reviewed by Cursor Bugbot for commit 6d63332. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt Outdated
Comment thread app/src/main/java/com/duckduckgo/app/browser/omnibar/OmnibarLayout.kt Outdated
@GerardPaligot GerardPaligot self-assigned this Apr 15, 2026
Copy link
Copy Markdown
Contributor

@GerardPaligot GerardPaligot left a comment

Choose a reason for hiding this comment

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

Work as expected, also tested in bottom and split mode.

@0nko 0nko force-pushed the feature/ondrej/unify-keyboard-behavior branch from d25098d to a1aa34a Compare April 16, 2026 16:09
Copy link
Copy Markdown
Contributor

@GerardPaligot GerardPaligot left a comment

Choose a reason for hiding this comment

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

Not directly linked to keyboard behavior but related to your new scenarios, I found a case where the query in the address bar is wrong.

  1. Run a query with "cats"
  2. Tap on the address bar
  3. Remove the query
  4. Enter a new query without running it
  5. Tap on back button
  6. Page is still on "cats" but with your new query is in the address bar

But it is maybe the expected behavior for this scenario

Screen_recording_20260417_111933.mp4

@0nko
Copy link
Copy Markdown
Member Author

0nko commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6d63332. Configure here.

}
}
},
)
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.

Scroll listeners accumulate on repeated calls

Low Severity

addOnScrollListener is additive, so if configureAutoCompleteSuggestions() is called more than once, duplicate keyboard-dismiss scroll listeners accumulate on autoCompleteSuggestionsList. Unlike ChatTabFragment and SearchTabFragment, which call clearOnScrollListeners() in onDestroyView(), BrowserTabFragment never removes these listeners from the autocomplete RecyclerView. Each additional listener fires hideKeyboardRetainFocus() redundantly on every drag event.


Please tell me if this was useful or not with a 👍 or 👎.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6d63332. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants