Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BottomSheetController] Use view.bounds instead of view.frame when calculating sheet offset #2115

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

nodes11
Copy link
Contributor

@nodes11 nodes11 commented Jan 13, 2025

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

If the root view of the bottom sheet had a non-zero frame origin, the offset of the sheet would be miscalculated because the offset function was using the view frame and not the view bounds. When calculating the offset, we should use the view bounds so that the offset is calculated relative to the bottom sheet's root view's own space.

Binary change

(how is our binary size impacted -- see https://github.com/microsoft/fluentui-apple/wiki/Size-Comparison)

Verification

In the BottomSheetControllerDemo, I validated that the bottom sheet is correctly laid out when the bottom sheet view has an offset applied to its top anchor.

Visual Verification In the first row of images, you can see in the before that the sheet in the collapsed state is not visible and in the after it is. In the second row, you can see in the before that the sheet is push way off the screen due to the calculation using the frame and not the bounds, and in the after you can see that it is correctly positioned.
Before After
Screenshot 2025-01-13 at 12 03 18 PM Screenshot 2025-01-13 at 12 02 37 PM
Screenshot 2025-01-13 at 11 27 14 AM Screenshot 2025-01-13 at 12 02 25 PM

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)
Microsoft Reviewers: Open in CodeFlow

@nodes11 nodes11 requested a review from a team as a code owner January 13, 2025 20:09
@nodes11 nodes11 merged commit a73a822 into microsoft:main Jan 13, 2025
7 checks passed
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.

3 participants