Skip to content

iPad works like the Mac: layout, keys, downloads, desktop sites and PDFs - #1049

Closed
advenimus wants to merge 10 commits into
yetanotherbrowser:mainfrom
advenimus:advenimus/ios-ipad-improvements
Closed

advenimus wants to merge 10 commits into
yetanotherbrowser:mainfrom
advenimus:advenimus/ios-ipad-improvements

Conversation

@advenimus

Copy link
Copy Markdown
Contributor

What changes

On iPad, Yab now lays out and behaves like the Mac. The sidebar runs the window's height and the page is a card. The Mac's keys, menus and downloads button are there. Sites send their desktop pages, as Safari's do. A PDF opens as a file you can save. There is no issue for this yet; it is offered for review as a whole, and each commit stands on its own if you'd rather take part of it.

Why it happened

Each commit's message has its full cause; the main ones:

  • Downloads never started on iPad. The tablet tree never mounts ChromeLayer, where the phone keeps the download question. A site's first file asked a question nothing showed. The iPad now has the Mac's downloads button (Hoard), in the sidebar foot and in the band while the sidebar is away.
  • Google and other sites served their phone pages. Every navigation set preferredContentMode = .mobile. The iPad now leaves WebKit its recommended mode, and Site Controls asks for the mobile site instead (Site.mobile).
  • ⌘, opened the iOS Settings app. Yab's Settings command was disabled while Settings was up, so the key fell through to the system's own Settings item in the app menu. It now stays Yab's.
  • The phone's plate flashed over the page after All Tabs on iPad. The tablet tree mounted ChromeLayer while All Tabs was up, and it faded in as chromeOpacity went back to 1. It is no longer mounted there. The stack's circle isn't drawn on iPad either, and the other cards fade where they are.
  • A PDF couldn't be kept. WebKit's inline PDF view has no save. A document the tab opens (PDF, Office, iWork, rich text) now becomes a file in Downloads and opens in QuickLook. A tab out of sight still shows it inline.
  • A download in a new window was dropped. A tab whose first load became a file had no page to restore, so it was cancelled. It now keeps the file, and a window the page opened only for that file closes back to its opener.

The rest follows the Mac rather than fixing a cause:

  • the sidebar header and address plate, Show Address Bar, Show Tabs in Sidebar (the Mac's tab bar), and spaces paging on Motion.space;
  • the Mac's page keys (zoom, Reader, Stop, Copy Link, Print, Save as PDF), plus Duplicate Tab and Open in Split View;
  • menu actions found by name in the field;
  • the Mac's menu titles, and "iPad" in iPad strings;
  • the iPhone's Reload and Stop marks (MacGlyph);
  • a disc thrown from a held link into the downloads button, as Hoard's is.

Proof

  • Logic: tests that fail on main and pass here, among them:
    • TabletWorkspaceTests (chrome plan, pin columns, paging, geometry)
    • BrowserKeysTests (Settings stays Yab's, page keys, covered)
    • CommandRowsTests
    • PageMenuTests (desktop sites)
    • DownloadStoreTests (flights, waiting, document types)
    • PageDownloadTests: a PDF opens for the viewer and keeps its source; a PDF as a tab's first load still opens
    • TabStackTests: the iPad closing plan
  • Visible change: before and after screenshots of the iPad states below (-YabState tablet.strip, tablet.band, tablet.hidden, downloads.now).
Before After

Checked on

  • Yab Dev built from this branch on an iPad Air and an iPhone 18 Pro, and in the iPad Pro 13" and iPhone 18 Pro simulators.
  • Engine(s) tried: WebKit (the iOS app).

Checklist

  • The suites this touches pass on the iPad simulator, run through xcodebuild test:
    • TabletWorkspaceTests, TabletLayoutTests, BrowserKeysTests, CommandRowsTests and PageMenuTests
    • DownloadStoreTests, PageDownloadTests, TabStackTests and SettingsColumnTests
    • UI: TabletWorkspaceUITests, TabletChromeUITests, TabletArcSplitUITests and TabletLayoutUITests (before the rebase onto main; TabletWorkspaceUITests' All Tabs case again after it)
    • Known failures that also fail on main here:
      • TabletLayoutTests.testNativeTabletKeepsBothWebViewsAndDraftsWhileResizingAndRotating (scroll offset in the simulator)
      • DownloadsUITests' ask and held-link cases, which are phone-shaped on iPad
      • PageDownloadTests.testNativeRequestDownloadReportsItsAPIFrameWithoutNavigatingTheActualDocument, which cancels before the request reaches the test server about one run in six
  • ./design-check --base origin/main is clean.
  • Anything that changes how Yab looks was approved in the issue first. Not yet: happy to open one, or split this up as you prefer.
  • Each new menu item is also a command in the field. No Settings row was added on the Mac (NativeActions.swift is untouched); the iPad's new rows are iPad-only layout preferences.

…ebar foot

The iPad's toolbar layout never mounted ChromeLayer, where the phone keeps
the download question, the Now line and the Downloads page. A site's first
download asked a question nothing showed, so it never started.

- Downloads button in the sidebar foot (always) and in the toolbar while the
  sidebar is away, as the Mac's Hoard button: its popover asks a site's
  first file, then lists every file. Site Controls gains Downloaded Here and
  shows the Downloads page; its Downloads permission had the mic's mark.
- A chat's column stands beside the workspace instead of over its toolbar.
- The page keeps its card inset with the sidebar hidden, and the address
  capsule is the Mac's 36 points, centered between equal side groups.
- Pins follow the Mac's SideBar.pinColumns: rows fill the width, stay even.
- Settings moves to the app menu with ⌘, (the gear goes); ⇧⌘N opens a
  private tab; the sidebar's + holds New Private Tab and Spaces and Chats.
- Site Controls in the bar-less toolbar; share sheets point under the
  toolbar on iPad; topController skips a popover on its way out.
- The iPad Settings card: its head 12 points in from the top, and a tap
  beside it closes it.
Every navigation was asked for with preferredContentMode .mobile, so an
iPad got Google's and other sites' phone pages. An iPad now leaves WebKit
its recommended mode (desktop at full width, mobile in a narrow window),
and a site's switch in Site Controls asks for its mobile site instead,
kept as Site.mobile. The iPhone keeps mobile unless a site asks desktop.
The iPad had a full-width toolbar row over everything, unlike the Mac,
where the sidebar runs the window's height and the page is a card.

- The sidebar's header holds its door, All Tabs, and Back, Forward and
  Reload; the address is a plate under it (the Mac's Show Address Bar
  off). Show Address Bar on moves the address and the page's doors into a
  band over the card; a split keeps a band on each page with its own
  Back, split menu and close.
- Show Tabs in Sidebar off (⇧⌘S, Settings, the door's hold) puts the tabs
  in the Mac's tab bar across the top. The sidebar away, the band holds
  the door, + and All Tabs. ⇧⌘\ shows All Tabs.
- Spaces are pages side by side in the sidebar, sliding on Motion.space
  (the Mac's 0.2 s spring); a sideways swipe pages them as the Mac's two
  fingers do. The foot shows the space in front in color, the rest dimmed.
- Rows have the Mac's 36-point ground and 10-point radius inside a 44-point
  target, with pointer highlights.
- All Tabs grows its cards out of and back into the page card, and the
  sidebar and tab bar fade with the bar instead of popping back after.
- ⌘, stays Yab's while Settings is up: declining it handed the key to the
  system's own Settings item, which left Yab for the Settings app.
… in Split View

- Keys and the iPad's menu bar: Zoom In, Zoom Out and Actual Size (⌘= ⌘- ⌘0)
  and Show Reader (⇧⌘R) in View, Stop Loading (⌘.) beside Reload, Copy
  Link (⇧⌘C) in Edit, Print… (⌘P) in File.
- Print… and Save as PDF in Site Controls › More: the system's print panel
  with WebKit's print formatter, and the page as one PDF to the share sheet.
- A held link offers Open in Split View where a split can stand.
- A tab's hold offers Duplicate Tab.
Typing a command's name, or another word for it, offers it as a Yab row
with its keys: Zoom In, Show Reader, Print, Copy Link, New Private Tab,
Show Tabs in Sidebar and the rest of the keys' menu actions that have
something to do now. A whole name leads every other row, as AGENTS.md
asks of the Mac's field; a begun one stands under the first row.

mayUse splits into the covered check and offers(key), which the field
asks: the keys stay the field's while it is up, so a chosen command runs
once it has closed.
The plate drew them from prototype art while the iPad, the page menu and
the Mac use MacGlyph's yabReload and yabStop.
A shared DeviceWord gives "iPad" or "iPhone" for the strings that name
this device. Split View, Separate Split View, Close Split, Pin Tab, Unpin
Tab, Keep Tab, Don't Keep Tab and Rename Tab… now match the Mac's menus.
The tablet tree mounted ChromeLayer while All Tabs was up, so the phone's
plate, back button and the stack's circle faded in over the page as the
gallery closed (chromeOpacity returning to 1) and vanished only when it
was gone. The iPad's All Tabs lives in the sidebar: the phone chrome is no
longer mounted there, the circle is not drawn, and the other cards fade in
place rather than flying into a circle the iPad doesn't have.
… button

A PDF or another document a tab opens (Word, Excel, PowerPoint, iWork,
rich text) becomes a file: kept in Downloads without asking and shown in
QuickLook, which saves and shares it; WebKit's inline view had no way to
keep it. A tab out of sight still shows it inline.

A tab whose first load became a file (a new window's PDF or attachment)
was cancelled because there was no page to restore; it now keeps the
file, and a page-opened window that was only that file closes back to
its opener.

On iPad, Download Linked File throws a disc from where the link was held
into the downloads button, as the Mac's Hoard does: the button shows the
progress ring while it runs and the file's icon until the list or file
opens, giving a little at each arrival.
WKWebView.url can still name the file for a moment after the file is
whole, then reads the source again with no navigation and no change to
history (measured: /file at completion, /second 800 ms later, about one
run in eighteen). The tests read it at that moment and failed now and
then; they now wait for it to come back.
@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 1/5

[Medium impact] The PR changes the main browsing experience on iPad and several shared page workflows.

Do not merge until private document presentation and the two tablet control failures are fixed.

Findings

  1. P1 Security Private files reopen outside Private ▶
  2. P1 Empty spaces lose every control ▶
  3. P1 Narrow splits cut off controls ▶
  4. P2 Remote tabs cannot be duplicated ▶
  5. P2 Private command rows do nothing ▶
  6. P2 New actions evade command search ▶

Summary

This PR gives iPad a Mac-style workspace, more keyboard and field commands, desktop website defaults, and document downloads that open in QuickLook.

  • The iPad puts its tabs beside or above a framed page.
  • Downloads and opened documents have a home on iPad.
  • iPad sites use desktop pages unless a site is set to mobile.
  • Keyboard keys and the address field offer more browser actions.
  • App wording names the device as an iPad or iPhone.

Review checked source code only; iOS builds and simulator tests were not run here.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[iPad workspace] --> B{Tabs layout}
  B --> C[Sidebar with address plate]
  B --> D[Top tab bar with page band]
  A --> E[Downloads button]
  F[Document opened by a tab] --> G[Save file in Downloads]
  G --> H[Check source tab]
  H --> I[Open in QuickLook]
  E --> G
Loading

Reviews (1) · Last reviewed commit: "test: download tests wait for the source..." · Reviewed by Greptile

Comment on lines +21 to +25
pages.onViewDownload = { [weak self] tab, entry in
guard let self, let file = downloads.entry(entry),
browser.tab?.id == tab || browser.tab(tab) == nil else { return }
downloads.flashTaken()
openDownload(file)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 security Private files reopen outside Private. Start a document download in a private tab, close that tab while another private tab remains, then return to an ordinary page. The transfer continues, and browser.tab(tab) == nil lets its completion open the private document over that ordinary page. This also opens documents from closed public tabs over unrelated pages.

Track the actual opener instead of treating every missing tab as permission to present, and check the current privacy and foreground state before opening QuickLook.

How this was verified: Private transfers survive individual tab closures, and the completion opens QuickLook whenever the source tab is missing without checking which page or privacy state is now in front.

Comment on lines 167 to +177
@@ -150,7 +174,7 @@ struct TabletWorkspaceView: View {
let frame = plan.pane(second)
let focused = id == app.browser.tab?.id
VStack(spacing: 0) {
if paneBars { TabletPaneBar(tab: tab) }
if paneBars { TabletPageBand(tab: tab, plan: chrome, split: plan.split) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Empty spaces lose every control. With tabs in the sidebar and the sidebar hidden, closing the last selected tab makes ids empty. The address band now lives inside this loop, so its New Tab and Sidebar buttons disappear too. The old window-level toolbar remained available in this state.

Keep an empty-page band or another touch control outside the tab loop so the person can open a tab or restore the sidebar.

Comment on lines +311 to +315
private var side: CGFloat {
// Both ends as wide as the wider, so the site stays centered.
let leading = (plan.bandWorkspace ? 1 : 0) + (plan.bandNav ? 3 : 0)
let trailing = 1 + (split ? 2 : 0) + (plan.bandWorkspace ? 2 + (app.showsToolbarDownloads(sidebarShown: false) ? 1 : 0) : 0)
return Metrics.Tablet.door * CGFloat(max(leading, trailing))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Narrow splits cut off controls. Hide the sidebar, open Split View, and resize one pane to the supported 320-point minimum. side reserves 180 points at each end, or 216 when downloads are shown. Those fixed ends alone need 360 or 432 points, before the address and padding. The clipped pane therefore cuts off controls and leaves no usable address area.

Use a layout that fits the minimum pane width rather than reserving both full groups on both sides.

Comment on lines +1200 to +1201
if !tab.isMail, tab.navigationURL != nil {
item("Duplicate Tab", .yabTabPlus) { app.duplicate(tab) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Remote tabs cannot be duplicated. This menu belongs to a tab from the Mac, but duplicate passes its remote ID to openHeldLink. That function requires the source ID to exist in the local BrowserStore and returns immediately when it does not. Choosing the new item on a Mac-only tab therefore does nothing.

Create the local copy in the row's space without requiring a local source tab.

Comment on lines +68 to +69
// Yab's own menu actions, as the Mac's field finds them.
rows = Words.withCommands(rows, typed: field.words, commands: commandCandidates)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Private command rows do nothing. The new command rows are added in Private too, but choose rejects every .command before reaching the new switch case. Typing an exact command such as Reload Page puts that dead row first, so Return neither runs the command nor searches the words.

Either offer only commands that Private can run and allow them through, or leave those rows out of private results.

Comment on lines +306 to +308
var commandCandidates: [CommandCandidate] {
BrowserKey.all.filter { $0.commandable && offers($0) }
.map { CommandCandidate(token: $0.token, title: $0.title, aliases: $0.aliases, shortcut: $0.shortcut) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 New actions evade command search. commandCandidates only includes BrowserKey.all, which has no entries for the new Save as PDF, Duplicate Tab, or Split View actions. Typing those menu names therefore cannot find the actions. The repository requires new menu actions to be available by name in the command field.

Add command entries with the right availability checks, including actions that have no keyboard shortcut.

@serafimcloud

Copy link
Copy Markdown
Contributor

Thanks, this is a lot of good work. 99 files is too much to review and ship as one, so please split it. First, on its own: a private tab's download opening outside private mode, that's a privacy bug and we'd take it at once. Then the downloads button, desktop pages and PDFs as separate PRs, and the layout and keys last. Each commit already stands alone, so it should mostly be opening PRs from them.

@advenimus

Copy link
Copy Markdown
Contributor Author

Replaced by four smaller PRs, as the review asked for:

  1. A joining iPhone or iPad no longer makes a second Personal space #1106 A joining iPhone or iPad no longer makes a second Personal space (stands alone on main)
  2. iPad: downloads ask, desktop sites, ⌘, Settings, All Tabs without phone chrome #1107 iPad bug fixes: downloads ask, desktop sites, ⌘, Settings, All Tabs without phone chrome (stands alone on main)
  3. The Mac's page keys, Print, Save as PDF, Duplicate Tab, documents to the viewer #1108 The Mac's page features on iPhone and iPad (built on iPad: downloads ask, desktop sites, ⌘, Settings, All Tabs without phone chrome #1107)
  4. iPad workspace lays out as the Mac does #1109 iPad workspace lays out as the Mac does (built on The Mac's page keys, Print, Save as PDF, Duplicate Tab, documents to the viewer #1108; approval asked in iPad: lay out and behave like the Mac app #1105)

Every Greptile finding here is fixed in them.

@advenimus

Copy link
Copy Markdown
Contributor Author

Thanks, and sorry I missed this before opening the first split. Redone as you asked:

#1128, #1129, #1130 and #1132 each stand alone on main.

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.

2 participants