Skip to content

fix(ios): present share sheet from topmost controller - #7

Merged
bisonbet merged 1 commit into
mainfrom
pr-41-share-sheet
May 30, 2026
Merged

fix(ios): present share sheet from topmost controller#7
bisonbet merged 1 commit into
mainfrom
pr-41-share-sheet

Conversation

@bisonbet

Copy link
Copy Markdown
Owner

Cherry-picked from gonzalezreal/textual PR gonzalezreal#41

@bisonbet

Copy link
Copy Markdown
Owner Author

@codex please review this PR

1 similar comment
@bisonbet

Copy link
Copy Markdown
Owner Author

@codex please review this PR

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f44d432581

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +172 to +175
if let tabBarController = viewController as? UITabBarController,
let selectedViewController = tabBarController.selectedViewController
{
viewController.present(activityViewController, animated: true)
return topMostViewController(startingAt: selectedViewController)

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 Badge Check presented modals before selected tab

When the root controller is a UITabBarController that is itself presenting a sheet containing this text view, this returns the selected tab instead of following tabBarController.presentedViewController. In that scenario the share action is no longer presented from the actual topmost controller, so UIKit can present behind/fail over the active sheet; recurse into presentedViewController before unwrapping tab/navigation containers.

Useful? React with 👍 / 👎.

@bisonbet

Copy link
Copy Markdown
Owner Author

@codex please fix the issues you found with this PR - review the comments

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Fixed the topmost UIKit presenter traversal so presentedViewController is followed before unwrapping UITabBarController or UINavigationController, ensuring the share sheet is presented from an active modal sheet rather than the selected tab behind it.
  • Committed the change with commit 62626f0 and created a follow-up PR titled fix(ios): traverse presented controllers before containers.

Testing

  • swift format --ignore-unparsable-files --in-place Sources/Textual/Internal/TextInteraction/UIKit/UITextInteractionView.swift
  • git diff --check
  • ⚠️ swift test (blocked because SwiftPM dependency fetches from GitHub failed with CONNECT tunnel failed, response 403)

View task →

@bisonbet
bisonbet merged commit c6e5a21 into main May 30, 2026
@bisonbet
bisonbet deleted the pr-41-share-sheet branch May 30, 2026 00:19
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