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

Don't recreate pill buttons when the pill button bar's bounds change #2108

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

laminesm
Copy link
Contributor

@laminesm laminesm commented Nov 20, 2024

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

Recreating the pill buttons when the bounds property of the bar changes can lead to inconsistent frame calculations during layout passes. For instance, there's a use case where accessing the width of the bar's contentSize in viewDidLayoutSubviews or viewWillTransitionToSize returns 0 because the buttons are removed and being re-added during the layout pass. From the comment it's still unclear why this logic exists. With the help of #mischreiber, we think it's best to remove this logic altogether and find a less fragile fix if it breaks edge cases we're not aware of.

Binary change

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

Verification

Tested the Pill Button Bar on the demo app and on the client app use case. No regressions were observed even though large text mode support on the control is broken independent of this change.

Visual Verification
Before After
before_iphone_portrait after_iphone_portrait
before_iphone_landscape after_iphone_landscape
before_iphone_large_text after_iphone_large_text
before_ipda_portrait after_ipad_portrait
before_ipad_landscape after_ipad_landscape
before_ipad_large_text after_ipad_large_text

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

@laminesm laminesm requested a review from a team as a code owner November 20, 2024 18:19
@laminesm laminesm merged commit 29d8c31 into main Nov 20, 2024
7 checks passed
@laminesm laminesm deleted the laminemale/dont-recreate-buttons-in-pbb branch November 20, 2024 22:43
@laminesm laminesm restored the laminemale/dont-recreate-buttons-in-pbb branch November 20, 2024 22:43
@laminesm laminesm deleted the laminemale/dont-recreate-buttons-in-pbb branch November 20, 2024 22:43
@joannaquu joannaquu mentioned this pull request Nov 21, 2024
12 tasks
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