Skip to content

Library: a gift button right of the back arrow, as in Arc, opens Share Cra with a Friend - #1099

Merged
VictorKildahl merged 1 commit into
VictorKildahl:mainfrom
tonibiocic:library-gift-button
Dec 2, 2026
Merged

VictorKildahl merged 1 commit into
VictorKildahl:mainfrom
tonibiocic:library-gift-button

Conversation

@tonibiocic

Copy link
Copy Markdown
Contributor

Cra's Library gets Arc's gift button at its foot, right of the back arrow. A click on it opens Share Cra with a Friend on the browser window, and the Library stays open under the sheet. People who come from Arc find the button where Arc had it, and nobody has to go to Settings to share Cra any more.

Cra with this PR: the Library's foot, with the back arrow and the gift button right of it.

What and why

In Arc, the gift button sits right of the back arrow at the Library's foot and opens "Share Arc with a friend". On main, Cra's Library has the back arrow alone, and Share Cra with a Friend opens only from Settings' first tab. No issue exists for it. This PR goes out together with #1098, which fixes the text of the sheet that the gift button opens. The two PRs are separate on purpose, so you can take one without the other: the gift button works with main's sheet, and the Share text fix works without the button. This branch does not hold that fix, so the picture of the sheet below shows its message and its link cut with "…", as main draws them. git merge-tree merges the two branches without a conflict. Both change AppDelegate.swift and MemberCardView.swift, in different places, so the two can merge in either order.

Arc: the Library's foot, with an arrow that points at the gift button right of the back arrow.

docs/arc-reverse-engineering.md already has Arc 1.170's Library foot, from its accessibility tree: the back arrow is 32 × 32 pt at x 8, 8 pt above the bottom, and the gift button is at x 73. Cra gives the gift button the arrow's size and the arrow's row. So the gift button is 8 pt in from the right edge of the 113 pt rail, as the arrow is 8 pt in from its left edge: 113 − 8 − 32 = 73.

With this PR:

  • The gift button is the SF Symbol gift at 15 pt, drawn as the back arrow is: a SidebarGlyphButton with the arrow's size, weight, colours and hover fill. Its tooltip is "Share Cra with a friend", the title of the sheet. I did not check Arc's tooltip.
  • A click opens the sheet that Settings opens, on the browser window, and the Library stays open under it. MainWindowController.showShareCra() puts the sheet there through DialogPanel.present, as the other sheets that AppKit hangs on a window. When the window already has a sheet, the click opens nothing.
  • SwiftUI's dismiss closes only what SwiftUI presented. So ShareCraSheet takes an optional close, which its × button and Escape call. Settings passes none, and its sheet works as before.
  • Arc had the button, so no setting gates it.
  • The sheet itself does not change. It copies or shares crabrowser.app tagged utm_campaign=share, and no account or server counts the shares.
  • LibraryRailTile.backFrame and LibraryRailTile.giftFrame in CraCore place the two buttons. docs/arc-parity.md and docs/arc-reverse-engineering.md name the gift button.
Arc's "Share Arc with a friend" after a click on the gift button, with the end of the gift link covered. Cra with this PR: Share Cra with a Friend on the browser window after a click on the gift button, with the Library open under it and the ticket's two lines cut with "…" as on main.

How I tested it

The branch is one commit, f96d2e4, on upstream main at 1d93d47. I rebased it onto 1d93d47 on 2026-12-02. Every result below ran on f96d2e4. The one exception is the picture of the Library's foot at the top, a cut of a window that I took on 42a3416a, the same change on the older main 60d19dd. git patch-id gives both commits the same id.

  • LibraryRailIconsTests.theGiftButtonSitsRightOfTheBackArrowAsArcs in CraCore, 1 new test. It checks the back arrow at x 8 and the gift button at x 73, both 32 × 32 pt and 8 pt above the bottom. In a short window, the row moves with the bottom, the gift button stays clear of the arrow, and it stays 8 pt in from the rail's right edge. Result: ✔ Test theGiftButtonSitsRightOfTheBackArrowAsArcs() passed.
  • A new scenario, library-gift, through a new hook, cra://debug?libraryGift=1, which presses the gift button as a click does. It opens the Library and checks the gift button's glyph, tooltip and place beside the back arrow. Then it checks that the sheet opens on the window, and that a second press while the sheet is up opens no second sheet. After the sheet closes, the window has no sheet, and the Library is still open. Result: library-gift: passed, on its first run, in a test copy behind other apps. Its log has library gift: pressed gift "Share Cra with a friend" at 73,840 32x32, back arrow at 8,840 32x32.
  • scripts/lint.py: lint: clean (29 grandfathered findings).
  • scripts/test.sh core: CraCore runs 3300 tests in 566 suites, and 1 fails: AppIconGridTests.theTilesAreTheIconsAsMacOSDrawsThem (feat: new native designs for all icons #935). At AppIconGridTests.swift:87, scripts/render-icon-as-macos.sh exits 1 on my Mac, so the test has no picture to compare. This PR does not touch the app icon. The other 16 steps of test.sh core pass, and the run ends in Failed: CraCore.
  • scripts/promises.py: promises: 2425 tests pinned for 583 issues and 33 crash fixes and 22 web features, unchanged. No issue exists, so this PR locks no test.
  • scripts/build.sh builds build/Cra.app from this commit.
  • The full scripts/test.sh: of its 80 steps, only CraCore fails, with the same icon test as its one failure. Its Lint step prints lint: clean (29 grandfathered findings), and the run ends in Failed: CraCore.

…hare Cra with a Friend

Arc's Library has a gift button at its foot, right of the back arrow, that opens "Share Arc with a friend". Cra's had
the arrow alone, and its Share Cra with a Friend sheet only on Settings' first tab. The button is now there, 32×32 pt
at x 73 on the arrow's row (Arc 1.170's AX frame: the arrow's place mirrored against the 113 pt rail), drawn as the
arrow is: the gift symbol at 15 pt in the sidebar's glyph tone, the same hover fill, and the tip "Share Cra with a
friend", the sheet's own title. CraCore LibraryRailTile.backFrame and giftFrame place both. Arc had it, so no setting
gates it, and an incognito window's Library has it too.

The click opens the sheet Settings opens, on the browser window, with the Library left open under it
(MainWindowController.showShareCra, through DialogPanel like the other sheets AppKit hangs on a window; a sheet
already up keeps it from opening). SwiftUI's dismiss closes only what SwiftUI presented, so ShareCraSheet takes an
optional close, which its × and Escape call; Settings passes none, and its sheet is as before.

Tests: LibraryRailIconsTests.theGiftButtonSitsRightOfTheBackArrowAsArcs (with the gift beside the arrow at x 48 it
fails on x 73 and on the 8 pt to the rail's edge); scenario library-gift (the button's glyph, tip and place by the
arrow's, the sheet on the window, no second one while it is up, none after endSheets, the Library still open).
cra://debug adds libraryGift.
@greptile-apps

greptile-apps Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5RetriggerView in Greptile

[Low impact] The new sharing route is limited to the Library and its browser window.

The PR appears safe to merge, with a non-blocking gap in the dismissal test.

Findings

  1. P2 Dismissal test skips user action ▶

Summary

Adds a gift button beside the Library’s back arrow and opens the existing sharing sheet on that browser window.

  • The Library gift button opens Cra’s sharing sheet.

tonibiocic explicitly acknowledged the existing truncated sheet text and deferred its fix to #1098. It is not reported here.

Build, runtime, and visual checks were not run in this Linux environment.

Reviews (1) · Last reviewed commit: "The Library's gift button, right of its ..." · Reviewed by Greptile

Comment on lines +19 to +20
# Closed as Escape would: the window has no sheet again, and the Library is still there.
cra://debug?endSheets=1

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 Dismissal test skips user action

endSheets=1 calls endSheet directly, bypassing the new ShareCraSheet.close callback. This scenario would still pass if the sheet’s × button or Escape stopped closing it. Exercise the close button or Escape, then keep the checks that the sheet is gone and the Library remains open.

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!

@VictorKildahl
VictorKildahl merged commit 083d5d2 into VictorKildahl:main Dec 2, 2026
1 of 5 checks passed
@VictorKildahl

Copy link
Copy Markdown
Owner

Thanks, @tonibiocic! The gift button is on main as 083d5d2, merged after #1098, and will be in the next release.

On the merge with main (#1098's ticket fix, the .74 engine and #1074), scripts/test.sh passes, and so do library-gift, share-cra-ticket and LibraryRailIconsTests. The log has the gift at 73,840 32×32 beside the back arrow at 8,840, the sheet opening on the window, and a second press opening nothing while it's up. No fixups were needed.

@VictorKildahl

Copy link
Copy Markdown
Owner

Shipped in Cra 0.1.62: https://github.com/VictorKildahl/cra/releases/tag/v0.1.62. Thank you @tonibiocic!

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