Skip to content

Fix omnibar input text pushed off-screen by long suggestion suffixes#2562

Merged
noisysocks merged 3 commits intomainfrom
randerson/fix-omnibar-long-suggestions
Mar 20, 2026
Merged

Fix omnibar input text pushed off-screen by long suggestion suffixes#2562
noisysocks merged 3 commits intomainfrom
randerson/fix-omnibar-long-suggestions

Conversation

@noisysocks
Copy link
Contributor

@noisysocks noisysocks commented Mar 19, 2026

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/1209121419454298/task/1213440750515602

Description

When a history entry with a long title (e.g., "Tripadvisor: Over a billion reviews & contributions for Hotels, Attractions, Restaurants, and more") was selected in the omnibar, the suffix text pushed the user's typed text off-screen.

Root cause: The input's padding-right was set from a JS-measured suffix text width via canvas measureText(). For long titles, this consumed nearly the entire input width.

Fix: Replaced JS text measurement with CSS-only flex layout:

  • Input padding-right now only reserves space for the close button
  • .suffixSpacer (flex: none) positions the suffix after the completion text
  • .suffix truncates with ellipsis when space is limited
  • Removed the measureText canvas function entirely

Also updated suggestion list items to better match native macOS address bar:

  • Removed hard max-width: 60% cap on title
  • Title shrinks 1.5x faster than suffix (flex: 0 1.5 auto) matching native's lower title compression resistance
  • Suffix fills remaining space to right edge (flex: 1 1 auto)
  • Added text-align: left to override <button> default center alignment

Testing Steps

Checklist

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it changes omnibar input/suggestions layout and relies on CSS overflow/flex behavior that can differ across browsers, plus updates test expectations.

Overview
Fixes an omnibar rendering bug where long selected-suggestion suffixes could consume the input width and hide the user’s typed text by removing JS canvas text measurement and switching to a CSS-only flex/ellipsis layout (input only reserves space for the close button).

Tweaks suggestion row layout to better balance title vs suffix truncation (flex adjustments and text-align: left). Adds a component showcase for omnibar states (with mock provider/data), extends mocks to include a long history entry, and updates/expands Playwright coverage (suggestion count + new long-suggestion screenshot test).

Written by Cursor Bugbot for commit 3f4324e. This will update automatically on new commits. Configure here.

When a suggestion with a long title was selected, the suffix text width
(measured via canvas) was used to set the input's padding-right, consuming
nearly the entire input width and hiding the user's typed text.

Replaced JS-based text measurement with CSS-only flex layout:
- Input padding-right now only reserves space for the close button
- suffixSpacer (flex: none) positions the suffix after the completion text
- suffix truncates with ellipsis when space is limited

Also updated suggestion list items to match native macOS address bar layout:
- Removed hard 60% max-width cap on title
- Title and suffix share space proportionally (title flex-shrink: 1.5)
- Suffix fills remaining space to the right edge (flex: 1 1 auto)
- Added text-align: left to override button default center alignment

Added component showcase examples and screenshot test for long suggestions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the semver-patch Bug fix / internal — no release needed label Mar 19, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

[Beta] Generated file diff

Time updated: Fri, 20 Mar 2026 00:29:20 GMT

Apple
    - apple/pages/new-tab/dist/index.css
  • apple/pages/new-tab/dist/index.js

File has changed

Integration
    - integration/pages/new-tab/dist/index.css
  • integration/pages/new-tab/dist/index.js

File has changed

Windows
    - windows/pages/new-tab/dist/index.css
  • windows/pages/new-tab/dist/index.js

File has changed

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Build Branch

Branch pr-releases/randerson/fix-omnibar-long-suggestions
Commit 7d82eb5c6c
Updated March 20, 2026 at 12:28:43 AM UTC

Static preview entry points

QR codes (mobile preview)
Entry point QR code
Docs QR for docs preview
Static pages QR for static pages preview
Integration pages QR for integration pages preview

Integration commands

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#pr-releases/randerson/fix-omnibar-long-suggestions

Swift Package Manager (Apple):

.package(url: "https://github.com/duckduckgo/content-scope-scripts.git", branch: "pr-releases/randerson/fix-omnibar-long-suggestions")

git submodule (Windows):

git -C submodules/content-scope-scripts fetch origin pr-releases/randerson/fix-omnibar-long-suggestions
git -C submodules/content-scope-scripts checkout origin/pr-releases/randerson/fix-omnibar-long-suggestions
Pin to exact commit

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#7d82eb5c6c85b3917b7fabae878f9289913376f3

Swift Package Manager (Apple):

.package(url: "https://github.com/duckduckgo/content-scope-scripts.git", revision: "7d82eb5c6c85b3917b7fabae878f9289913376f3")

git submodule (Windows):

git -C submodules/content-scope-scripts fetch origin pr-releases/randerson/fix-omnibar-long-suggestions
git -C submodules/content-scope-scripts checkout 7d82eb5c6c85b3917b7fabae878f9289913376f3

@github-actions
Copy link
Contributor

⚠️ Cursor assessed this PR as unknown Risk (only Low Risk is auto-approved).

This PR requires a manual review and approval from a member of one of the following teams:

  • @duckduckgo/content-scope-scripts-owners
  • @duckduckgo/apple-devs
  • @duckduckgo/android-devs
  • @duckduckgo/team-windows-development
  • @duckduckgo/extension-owners
  • @duckduckgo/config-aor
  • @duckduckgo/breakage-aor
  • @duckduckgo/breakage

Copy link
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.

Stale comment

Web Compatibility Assessment

  • No findings (no error/warning) in hostile-page API override categories. This PR does not touch injected runtime surfaces (wrapper-utils, DDGProxy, captured-globals, message bridge) and stays within special-pages/pages/new-tab omnibar UI/layout and test data.
  • special-pages/pages/new-tab/app/omnibar/components/SearchForm.js (removed canvas measureText path): change reduces potential runtime throw paths (getContext('2d') null handling) and avoids text-width precomputation sensitivity.
  • special-pages/pages/new-tab/app/omnibar/components/SearchForm.module.css and SuggestionsList.module.css: flex/ellipsis-based truncation is consistent with native-like behavior and avoids previously fixed-width suffix reservation pushing input text off-screen.

Security Assessment

  • No findings (critical/error/warning).
  • No changes to privileged messaging transport, origin checks, event secrets, or config gating.
  • No new dynamic code execution (eval/Function), no new network requests, no postMessage changes, and no unsafe HTML injection patterns.
  • Added mock/example data is static and rendered as text nodes in Preact; no new data-exfiltration vector introduced.

Risk Level

Low Risk — scope is limited to omnibar presentation logic, mock data, examples, and screenshot/integration expectations, with no modifications to injected security-sensitive infrastructure.

Recommendations

  1. Run special-pages screenshot tests on at least macOS + Windows projects to confirm truncation behavior remains stable across font metrics.
  2. Add a focused integration assertion that the typed input remains visible when selected suggestion has a very long suffix (guard against regression of this exact bug class).
  3. Keep the new omnibar examples as golden cases and include one RTL locale screenshot in follow-up coverage to validate truncation/alignment invariants.
Open in Web View Automation 

Sent by Cursor Automation: Web compat and sec

Copy link
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.

Web Compatibility Assessment

  • No blocking findings.
  • special-pages/pages/new-tab/app/omnibar/components/SearchForm.js (~62-63, ~116-123, ~184-223), info: Replacing dynamic canvas text measurement with CSS truncation reduces layout fragility and removes a runtime throw path from canvas.getContext('2d') failure. This aligns with compatibility-safe behavior for long suffixes and keeps input interaction contract unchanged.
  • special-pages/pages/new-tab/app/omnibar/components/SearchForm.module.css (~13-44, ~49-57), info: The new flex/ellipsis handling for .suffixSpacer and .suffix is consistent with the intended UI contract (input text remains visible; long suffixes truncate) and avoids prior right-padding over-allocation.

Security Assessment

  • No findings.
  • Scope is limited to special-pages/pages/new-tab UI/styles/mocks/tests; there are no changes to injected hostile-page runtime surfaces (captured-globals, wrapper utilities, DDGProxy, message bridge, platform transports, or config patching logic).

Risk Level

Low Risk: Changes are confined to NTP omnibar presentation and test fixtures/snapshots, with no modifications to security-critical injection or messaging paths.

Recommendations

  1. Add one assertion in omnibar integration tests to verify typed text/caret remains visible with long selected suffix on narrow viewport widths (not just screenshot baselines).
  2. Extend screenshot coverage to at least one non-darwin rendering target to catch font-metric/flex truncation differences across platforms.
Open in Web View Automation 

Sent by Cursor Automation: Web compat and sec

@noisysocks noisysocks requested a review from shakyShane March 20, 2026 00:39
Copy link
Contributor

@shakyShane shakyShane left a comment

Choose a reason for hiding this comment

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

excellent

@noisysocks noisysocks added this pull request to the merge queue Mar 20, 2026
Merged via the queue into main with commit 5c49e2a Mar 20, 2026
42 checks passed
@noisysocks noisysocks deleted the randerson/fix-omnibar-long-suggestions branch March 20, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Bug fix / internal — no release needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants