feat: optional anchor for iPadOS/macOS share popovers - #12
Merged
AbassHammed merged 2 commits intoJul 31, 2026
Conversation
Add an `anchor` option to `ShareData`/`ShareOptions` containing a source rect in web-viewport coordinates. Use it on iPad and macOS to anchor the system share popover instead of centering it on the window. Closes sudosylabs#11
AbassHammed
self-requested a review
July 30, 2026 15:47
Contributor
|
This looks good, need to test this locally then i can merge. Thanks though @karlingen |
AbassHammed
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the optional
anchorfield requested in #11 so that the share popover on iPadOS/macOS can anchor to a source rectangle instead of always centering on the window.Changes
anchor?: { x, y, width, height }toShareData(guest-js/index.ts) andShareOptions(src/models.rs).ios/Sources/SharePlugin.swift): caches theWKWebViewfromload(webview:), then setspopoverController.sourceViewandpopoverController.sourceRectfrom the anchor when provided, falling back to the previous centered behavior.src/platform/macos.rs): converts the anchor rect from web-viewport (top-left origin) coordinates to AppKit (bottom-left origin) coordinates and passes it toshowRelativeToRect_ofView_preferredEdge, falling back to the view center when no anchor is provided.android/src/main/java/SharePlugin.kt): addedAnchor/ShareOptions.anchormodels so deserialization stays compatible; the anchor is otherwise ignored.ShareOptionssnippet.Verification
cargo +1.89.0-aarch64-apple-darwin test— 11 passedcargo +1.89.0-aarch64-apple-darwin fmt --check— cleancd ios && VNIDROP_SHARE_USE_TAURI_STUB=1 swift test— 5 passednpm run build—dist-jsandapi-iife.jsregeneratednpm run test— 8 passednpm run test:types— cleanCloses #11