Skip to content

Polish URL-related UI feedback#242

Merged
yonaries merged 17 commits intomainfrom
polish/url
Mar 16, 2026
Merged

Polish URL-related UI feedback#242
yonaries merged 17 commits intomainfrom
polish/url

Conversation

@yonaries
Copy link
Copy Markdown
Contributor

Summary:

  • Major: align URL handling and display across launcher, browser, and sidebar views to improve UX polish.
  • Minor: tweak copied-url overlay behavior and icon assets for consistency.

Testing:

  • Not run (not requested)

@yonaries yonaries requested a review from kenenisa as a code owner March 16, 2026 07:08
@tembo tembo bot added the enhancement improvements label Mar 16, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 16, 2026

Greptile Summary

This PR overhauls URL handling and display across the browser, replacing the simple inline TextField in URLBar with a full inline launcher that provides search suggestions, history, and AI chat options directly from the URL bar. It also converts SidebarURLDisplay from an editable field into a display-only view that opens the center launcher on tap. A new shared URLDisplayUtils utility centralizes host+title formatting, and new custom shield icons (ShieldLockIcon, ShieldBanIcon) are added for security indicators.

  • URLBar rewrite: Embeds LauncherViewModel directly into the URL bar for inline search/suggestions with keyboard navigation, dimming overlay on web content, and proper lifecycle management (focus, mouse monitor, suppress initial search)
  • LauncherViewModel extensibility: Adds navigateInCurrentTab mode and onDismiss callback so the view model can be reused in both the center launcher and the inline URL bar context
  • SidebarURLDisplay simplification: Removes inline editing in favor of opening the center launcher, with URL pre-fill via appState.launcherSearchText
  • URLBarMenuButton extraction: New component wrapping the ellipsis button with an NSMenu for share actions, with proper NSObject lifetime management
  • UI polish: Default showFullURL changed to false, suggestion items use flexible widths, corner radius and opacity tweaks across buttons
  • Issue found: SidebarURLDisplay.triggerCopy no longer shows a toast notification, creating an inconsistency with URLBar which still shows one

Confidence Score: 4/5

  • This PR is generally safe to merge — it's a UI-only refactor with one behavioral inconsistency to address.
  • The changes are well-structured and the inline launcher integration reuses existing, proven logic from LauncherViewModel. The main concern is the missing toast notification in SidebarURLDisplay creating a UX inconsistency. There's also minor dead code and commented-out code that should be cleaned up. No data model, persistence, or security-sensitive changes are involved.
  • ora/Features/Sidebar/Views/SidebarURLDisplay.swift (missing copy toast, dead code), ora/Features/Browser/URLBar/URLBar.swift (largest change surface — verify inline launcher lifecycle edge cases)

Important Files Changed

Filename Overview
ora/Core/Utilities/URLDisplayUtils.swift New utility that centralizes URL display logic (host extraction, www stripping, title formatting) used by both URLBar and SidebarURLDisplay.
ora/Features/Browser/URLBar/URLBar.swift Major rewrite: replaces inline TextField editing with a full inline launcher (suggestions, search engine integration, keyboard nav). Adds dim overlay on web content while editing. Well-structured with clear MARK sections.
ora/Features/Browser/URLBar/URLBarButton.swift Adjusts opacity levels and corner radius. The #available check is now redundant since both branches return 10.
ora/Features/Browser/URLBar/URLBarMenuButton.swift New menu button extracted from the old ellipsis button, using NSMenu for share functionality with proper lifetime management via representedObject.
ora/Features/Browser/Views/BrowserWebContentView.swift Refactors web content into a separate @ViewBuilder property and adds a dimming overlay when URL bar editing is active.
ora/Features/Launcher/LauncherView.swift Adds support for pre-filling launcher input from launcherSearchText and passes new onDismiss callback to the view model.
ora/Features/Launcher/State/LauncherViewModel.swift Adds navigateInCurrentTab mode and onDismiss callback for reuse in the URL bar's inline launcher. Correctly branches between loading in current tab vs opening a new tab.
ora/Features/Sidebar/Views/FloatingSidebar.swift Adds .padding(.top, 0) which has no effect — appears to be a no-op leftover.
ora/Features/Sidebar/Views/SidebarURLDisplay.swift Major rewrite: replaces inline editing with a display-only view that opens the center launcher on tap. Missing toast on copy action (inconsistent with URLBar), and contains dead code (displayURL function).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User taps URL bar] --> B{URLBar: startEditing}
    B --> C[Set appState.isURLBarEditing = true]
    C --> D[setupInlineLauncher]
    D --> E[Configure LauncherViewModel\nnavigateInCurrentTab: true]
    D --> F[Pre-fill launcherInput with current URL]
    D --> G[Suppress initial search for 150ms]
    D --> H[Focus LauncherTextField]

    H --> I{User types}
    I --> J[LauncherViewModel.searchHandler]
    J --> K[Show suggestions overlay]

    I --> L{User presses Enter}
    L --> M[executeCommand → run focused suggestion action]
    M --> N[Load URL in current tab]
    M --> O[onDismiss → dismissEditing]

    I --> P{User presses Escape}
    P --> O

    Q[User taps sidebar URL display] --> R[Set appState.launcherSearchText]
    R --> S[Set appState.showLauncher = true]
    S --> T[LauncherView opens with pre-filled URL]

    U[User taps dimmed web content] --> V[Set appState.isURLBarEditing = false]
    V --> W[cleanupInlineLauncher]
Loading

Comments Outside Diff (1)

  1. ora/Features/Browser/URLBar/URLBarButton.swift, line 11-17 (link)

    Redundant availability check — both branches return 10

    After changing the else branch from 6 to 10, both branches now return the same value, making the #available check dead code. Note that URLBarMenuButton still uses 6 for pre-macOS 26 — was this intentional divergence, or should URLBarMenuButton also be updated to 10?

Last reviewed commit: ad37e4d

Comment on lines 16 to 22
private func triggerCopy(_ text: String) {
ClipboardUtils.triggerCopy(
text,
showCopiedAnimation: $showCopiedAnimation,
startWheelAnimation: $startWheelAnimation
)
toastManager.show("Link copied", icon: .ora(.copy))
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing toast on sidebar copy action

The toastManager.show("Link copied", ...) call was removed from triggerCopy in this file, but it's still present in URLBar.swift:54. This creates an inconsistent user experience: copying a URL from the URL bar shows a toast, but copying from the sidebar does not.

Additionally, toastManager (line 9) is now unused in this view since the toast call was the only place it was used — the @EnvironmentObject declaration can be cleaned up if the toast removal was intentional, or the toast should be restored for consistency.

Suggested change
private func triggerCopy(_ text: String) {
ClipboardUtils.triggerCopy(
text,
showCopiedAnimation: $showCopiedAnimation,
startWheelAnimation: $startWheelAnimation
)
toastManager.show("Link copied", icon: .ora(.copy))
}
private func triggerCopy(_ text: String) {
ClipboardUtils.triggerCopy(
text,
showCopiedAnimation: $showCopiedAnimation,
startWheelAnimation: $startWheelAnimation
)
toastManager.show("Link copied", icon: .ora(.copy))
}

var body: some View {
HStack {
Image(systemName: "link")
// Image(systemName: "link")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Commented-out code left behind

This line should be deleted rather than commented out. If the icon is no longer desired, remove it entirely to keep the code clean.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +116 to +118
private func displayURL(for tab: Tab) -> String {
URLDisplayUtils.displayString(url: tab.url, title: tab.title, showFull: toolbarManager.showFullURL)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead code — displayURL(for:) is never called

This function is defined but never referenced. Only displayParts(for:) (line 120) is used in the view body. This should be removed.

Suggested change
private func displayURL(for tab: Tab) -> String {
URLDisplayUtils.displayString(url: tab.url, title: tab.title, showFull: toolbarManager.showFullURL)
}

.overlay(clipShape
.stroke(theme.invertedSolidWindowBackgroundColor.opacity(0.3), lineWidth: 1)
)
.padding(.top, 0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No-op padding

.padding(.top, 0) has no visual effect and appears to be a leftover from iterating on spacing values. Consider removing it to reduce noise.

Suggested change
.padding(.top, 0)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@yonaries yonaries merged commit 7c2210a into main Mar 16, 2026
2 checks passed
@yonaries yonaries deleted the polish/url branch March 16, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant