Skip to content

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

Open
tordans wants to merge 2 commits into
masterfrom
cursor/osm-notes-autolink-webview-panel
Open

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

Conversation

@tordans

@tordans tordans commented May 31, 2026

Copy link
Copy Markdown
Owner

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
Scoped UI change on the notes screen with http/https-only interception; WKWebView loads user-supplied note URLs but mirrors existing external browsing risk with an in-app escape hatch to Safari.

Overview
OSM note history comments now auto-detect http/https URLs and open them in a dismissible in-app sheet instead of leaving plain text or jumping straight to the system browser.

NotesTableViewController wires history UITextView cells through a new UITextView+DetectedLinks helper (configureForDetectedLinks / clearDetectedLinks on reuse), sets delaysContentTouches = false so links respond reliably in the table, and handles textView(_:shouldInteractWith:…) only for history cells: http/https taps go to PanelWebViewController; other schemes and the new-comment field keep default behavior. Mapper username taps still use SFSafariViewController.

PanelWebViewController is new: WKWebView in a .pageSheet with medium/large detents (iOS 15+), loading/error UI, Done, and Open in Safari, using the app’s setUserAgent() on the initial load. URL.isHttpURL supports the tap filter. Xcode project entries add the new sources.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

@tordans tordans closed this Jun 6, 2026
@tordans tordans reopened this Jun 6, 2026
Improve link tap reliability in note cells, add web panel loading/error states, and centralize detected-link configuration for reuse.

Co-authored-by: Cursor <cursoragent@cursor.com>
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