Don't recreate pill buttons when the pill button bar's bounds change #2108
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.
Platforms Impacted
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
inviewDidLayoutSubviews
orviewWillTransitionToSize
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
Pull request checklist
This PR has considered:
Microsoft Reviewers: Open in CodeFlow