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

Make PillButtonBarItem title mutable and set its font earlier #1295

Merged
merged 7 commits into from
Oct 19, 2022

Conversation

lcapkovic
Copy link
Contributor

@lcapkovic lcapkovic commented Oct 15, 2022

Platforms Impacted

  • iOS
  • macOS

Description of changes

Despite the naming, PillButtons and their corresponding PillButtonBarItems get used outside of the PillButtonBar.
We have a specific use where we need the title to be mutable (persistent pill button that represents a current tab switcher selection). This PR adds title mutability to the PillButtonBarItem.

This PR also includes a slight adjustment to how iOS 15+ attribute title creation is done. We now set the font as soon as possible, and only leave the color changing to the updateAppearance function. This resolves a bug where intrinsic size was incorrect before updateAppearance runs when dynamic size was enabled.

Verification

Made a new demo VC that is tailored to Pill buttons outside of the pill button bar.

Screenshot 2022-10-14 at 5 46 32 PM

Before After
Screenshot 2022-10-14 at 5 55 21 PM Screenshot 2022-10-14 at 5 56 06 PM

(no visual change to pill button bar intended)

Tested iOS 14 as well to verify the old non-configuration paths still work.

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)

@lcapkovic lcapkovic requested a review from a team as a code owner October 15, 2022 01:01
@lcapkovic lcapkovic changed the title Make PillButtonBarItem titles mutable and set the font earlier Make PillButtonBarItem titles mutable and set their font earlier Oct 15, 2022
@lcapkovic lcapkovic changed the title Make PillButtonBarItem titles mutable and set their font earlier Make PillButtonBarItem title mutable and set its font earlier Oct 15, 2022
@harrieshin harrieshin added the New API This PR introduces new API label Oct 19, 2022
@lcapkovic lcapkovic merged commit c1510a3 into microsoft:main Oct 19, 2022
@lcapkovic lcapkovic deleted the pillButtonFixes branch October 19, 2022 22:15
@harrieshin harrieshin mentioned this pull request Nov 14, 2022
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New API This PR introduces new API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants