Skip to content

feat(browser): long-press to hide New Tab promo sections (GitHub, Report, intro) - #472

Open
DudeAint wants to merge 3 commits into
mainfrom
feat/newtab-hide-section
Open

DudeAint wants to merge 3 commits into
mainfrom
feat/newtab-hide-section

Conversation

@DudeAint

Copy link
Copy Markdown
Owner

What

Long-press to hide the promotional sections on the New Tab page — the "Open on GitHub" rows, the "Extension not working? Report it" pill, and the intro card — as requested.

Hold the section → a small glass "Hide this" menu pops up → tap it → the section fades out and stays hidden on every future New Tab.

How

  • The New Tab page is served with baseURL: nil (no persistent localStorage), so the choice is persisted natively: the menu navigates to bbnewtab://hide/<id>, which the nav delegate intercepts, records in AppSettings.newTabHiddenSections, and cancels (the JS already removed the element for instant feedback).
  • The renderer omits hidden sections server-side, so they never flash on a new tab.
  • Long-press is a manual 450 ms touch-hold (-webkit-touch-callout/selection suppressed on .hideable); the link tap that would otherwise follow the hold is cancelled.
  • Hideable ids: github (both the guide row and the returning-user footer row), report, intro.

Verification

swiftc -parse clean; the inline long-press JS validates (node --check); body length ~390 (< 500), file 503 (< 1000) so SwiftLint stays green. No automated test — it's native long-press UI, device-observable: hold a GitHub/Report/intro section → "Hide this" → it's gone now and on the next New Tab.

Note: there's no in-UI "restore hidden sections" yet (matches the ask); a Settings reset can be added later if you want one.

🤖 Generated with Claude Code

…ort, intro)

Hold any promotional section on the New Tab page — the "Open on GitHub" rows, the
"Extension not working? Report it" pill, or the intro card — and a small glass
"Hide this" menu pops up; tapping it removes the section and keeps it hidden on
every future New Tab.

The page is served with baseURL nil (no persistent localStorage), so the choice
is persisted natively: the hold menu navigates to bbnewtab://hide/<id>, which the
nav delegate intercepts, records in AppSettings.newTabHiddenSections, and cancels
(the JS already removed the element for instant feedback). The renderer omits any
hidden section server-side so it never flashes. Long-press is a manual 450 ms
touch-hold (callout/selection suppressed on .hideable), and the link tap that
would otherwise follow the hold is cancelled. Hideable ids: github, report, intro.

swiftc -parse clean; the inline JS validates (node --check). No automated test —
it's native long-press UI, device-observable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the browser Browser foundation label Jun 16, 2026
Companion to the long-press hide: Settings › Appearance now shows "Restore hidden
New Tab sections" whenever the user has dismissed any (the count drives a caption),
clearing AppSettings.newTabHiddenSections so they all return on the next New Tab.
The row is hidden when nothing is dismissed. swiftc -parse clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the dashboard Manager dashboard label Jun 16, 2026
… works

The long-press "Hide this" menu never appeared because the New Tab page's links
are real <a href> in a WKWebView that has a UI delegate — so WebKit ignored the
page's -webkit-touch-callout:none and showed its own link menu (Copy Link / Open
in New Tab) instead. Suppress the system context menu when the web view is showing
the New Tab page (an actionProvider returning nil presents nothing), so the page's
JS owns the long-press and pops the Hide menu. Real navigation (tap) and the
post-long-press click cancel are unchanged; other pages keep WebKit's menu.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser Browser foundation dashboard Manager dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant