Back to Chromium

Component Spec: SearchBoxOmnibox

agents/projects/chrome-design-system/assets/component-specs/SearchBoxOmnibox_Spec.md

153.0.7995.15.8 KB
Original Source

Component Spec: SearchBoxOmnibox

This specification document outlines the mapping, design tokens, styling variants, and interactive states of the SearchBoxOmnibox (Autocomplete Suggestions Dropdown) component across Figma, C++ Views, and WebUI (Web Frontend).


Overview

The SearchBoxOmnibox component represents the autocomplete suggestion popup container that expands downwards below the Omnibox. It populates dynamic search terms, favicon cards, browser navigation history nodes, bookmarks, and site links as the user types queries.


1. Component Metadata & Source Files

FeatureFigma ComponentC++ Views (Desktop)WebUI (Web Frontend)
Component NameSearchBoxOmniboxviews::OmniboxPopupViewViews<omnibox-popup-searchbox> / <cr-searchbox-dropdown>
Source FilesFigma Link: 34968:6820chrome/browser/ui/views/omnibox/omnibox_popup_view_views.hchrome/browser/resources/omnibox_popup/omnibox_popup_searchbox.ts
ui/webui/resources/cr_components/searchbox/searchbox_dropdown.ts

2. Styling, Variants & Features (Layout & Style)

Feature / VariantFigma ComponentC++ Views (Desktop)WebUI (Web Frontend)
Search List LayoutContains suggestion rows (.base.searchbox.List-search)Instantiates OmniboxResultView entriesHosts dynamic <cr-searchbox-match> rows
History IconUses nested history vector symbolsRenders history clocks via custom vector assetsStandard SVG history clock icons
Favicon AssetHouses favicon container wrapperFetches and renders site-specific icon bitmapsDisplayed using favicon styling in <cr-searchbox-icon>

3. Component States

StateFigma ComponentC++ Views (Desktop)WebUI (Web Frontend)
Default (Normal)state=DefaultBase suggestion view renderingDefault suggestions row style
Hoveredstate=HoveredDisplays background focus highlights:hover styled background overlays
Pressedstate=PressedTriggers navigation click eventClick/Select trigger transitions
Disabledstate=DisabledGrayed out/non-clickable rowsN/A
Focused(Commonly represented)Selected row changes background highlightingselected property updates active row background

4. Design Token Comparison (Side-by-Side)

Design AttributeFigma Design TokenC++ Views (Desktop)WebUI (Web Frontend)
Dropdown Container BG--desktop/sys/surface-colors/surface
(white)kColorOmniboxResultsBackground--cr-menu-background-color
On-Surface Text--desktop/sys/surface-colors/on-surface
(#1f1f1f)kColorOmniboxResultsText--cr-primary-text-color
Dimmed Text Color--desktop/sys/surface-colors/on-surface-subtle
(#474747)kColorOmniboxResultsTextDimmed--cr-secondary-text-color
Corner Radius--desktop/corner-radius/16
(16px)Matches popup widget corner radii specsborder-radius: 12px; or 16px;
Elevation Drop Shadow--desktop/elevation/4
(Dual drop shadows)Handled dynamically by native window elevationHandled via CSS shadow/elevation maps

5. Architectural & Implementation Gaps

1. Floating Native Widget Overlay vs. inline DOM Trees

  • Figma: Placed as a static layout node below the omnibox.
  • C++ Views: Built as a separate, floating frameless window (views::Widget) that is dynamically positioned and resized directly below the location bar to sit above other web contents without clipping.
  • WebUI: Embedded directly as a standard shadow DOM child element (<cr-searchbox-dropdown>) inside the parent <omnibox-popup-searchbox> input host, flowing inline within the HTML renderer.

6. Styling, Variants, Features and States Mismatches

1. Active Highlighting Model

  • Figma: Handled statically.
  • C++ Views: Leverages custom selection managers. When users press Up/Down keys, the active row's background dynamically shifts to kColorOmniboxResultsBackgroundHovered or kColorOmniboxResultsBackgroundSelected to preserve accessible focus.
  • WebUI: Handled reactively using the selectedMatchIndex property in <cr-searchbox-dropdown>, setting active classes on child nodes.

7. Usage & UX Guidance

1. General Principles & Best Practices

  • Clean List Margins: Ensure text overflow uses ellipses (text-overflow: ellipsis) to prevent long URLs from breaking column lines.
  • Navigability: Keyboard arrow triggers must smoothly navigate the list entries.

2. Platform Consistency, Keyboard Controls & Accessibility (a11y)

  • Mojo IPC Coordination: The WebUI dropdown syncs dynamic list choices directly with the native C++ Autocomplete controller via Mojo bindings inside searchbox.mojom.

8. Inheritance Structure

  • C++ Views (Desktop):
    views::View (Base layout unit)
       └── views::WidgetDelegateView (Popup overlay manager)
              └── OmniboxPopupViewViews (Popup suggestion overlay)
    
  • WebUI (Web Frontend):
    HTMLElement (Browser element base)
       └── LitElement / CrLitElement (Web UI host)
              └── OmniboxPopupSearchboxElement (Custom WebUI searchbox container)
                     └── SearchboxDropdownElement (cr-searchbox-dropdown suggestion wrapper)