Skip to content

OSM notes: autolink comment URLs in dismissible web panel#14

Open
tordans wants to merge 1 commit into
masterfrom
cursor/osm-notes-autolink-webview-panel
Open

OSM notes: autolink comment URLs in dismissible web panel#14
tordans wants to merge 1 commit into
masterfrom
cursor/osm-notes-autolink-webview-panel

Conversation

@tordans
Copy link
Copy Markdown
Owner

@tordans tordans commented May 31, 2026

Problem

Go Map!! can display OpenStreetMap notes from the OSM Notes API. Note comments often contain plain-text URLs—for example links to StreetComplete photos or other mapping resources—but today those strings are shown as non-interactive text in the note history.

As a mapper, when I read an OSM note that includes a link, I want to tap the URL and view the page inside the app in a panel I can open and dismiss quickly, so I can check referenced photos or documentation without leaving the note context or switching to Safari for every link.


Implementation notes (by Cursor)

  • Branch: cursor/osm-notes-autolink-webview-panel
  • NotesTableViewController.swift
    • Note history comment UITextView cells use dataDetectorTypes = [.link] so http/https URLs in comment text are detected and styled as tappable links (autolinker via NSDataDetector).
    • textView(_:shouldInteractWith:in:interaction:) intercepts link taps on history comments only and opens the URL in a panel instead of the system browser.
  • PanelWebViewController.swift (new)
    • Programmatic WKWebView presented as .pageSheet.
    • On iOS 15+, medium and large sheet detents with a visible grabber for quick resize and swipe-to-dismiss.
    • Toolbar: Safari (open current page externally) and Done (dismiss panel).
    • Uses the app’s existing setUserAgent() on the initial request.
  • Unchanged: Username taps still open the OSM user profile in SFSafariViewController; new-comment text field behavior is unchanged.

Testing notes (@tordans)

  1. Enable notes overlay — Turn on Notes in display settings; pan to an area with open notes (or create a test note with a URL in the comment text).
  2. Autolink appearance — Open a note whose history contains https://… (e.g. a StreetComplete image URL). The URL should appear as a link-colored, tappable string in the comment bubble.
  3. Panel open — Tap the link → a sheet panel with web content should appear (not full-screen Safari).
  4. Panel dismiss — Swipe down or tap Done → panel closes; note screen remains open.
  5. Detents (iOS 15+) — Drag the sheet between medium and large; content should remain usable.
  6. Safari button — Tap the toolbar Safari icon → page opens in the external browser.
  7. No link — Comments without URLs behave as before (plain text, no false positives).
  8. Regression — Tap mapper username → still opens OSM user page; add comment / resolve note flows unchanged.

Made with Cursor


Note

Low Risk
Localized notes UI change; WKWebView loads user-supplied http/https URLs from comments with no change to auth or OSM upload flows.

Overview
OSM note history comments now treat http/https strings as tappable links and open them in a new in-app sheet instead of leaving them as plain text or using the system browser by default.

NotesTableViewController configures history UITextView cells with link detection and styling, and only intercepts link taps on those rows to present PanelWebViewController. Username taps still use SFSafariViewController; the new-comment field is unchanged.

PanelWebViewController is a programmatic WKWebView in a .pageSheet (medium/large detents and grabber on iOS 15+), with Done to dismiss and Safari to open the current page externally, using the app’s existing user agent on the initial load. The Xcode project registers the new source file.

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

Detect URLs in note history text and present them in a dismissible sheet web view instead of leaving links non-interactive.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown

@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, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5825743. Configure here.

}
PanelWebViewController.present(url: url, from: self)
return false
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All link interactions open panel, including long-press

Low Severity

The textView(_:shouldInteractWith:in:interaction:) delegate method presents the PanelWebViewController for all UITextItemInteraction types without checking the interaction parameter. This means a long-press (.presentActions) — which normally shows a context menu with "Copy Link", "Share", etc. — instead immediately opens the web panel. Users lose the ability to copy a URL from a note comment without fully loading the page.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5825743. 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.

1 participant