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

[main_0.13] [cherry-pick] PillButton text should not scale with DynamicType. (#1601) #1605

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ios/FluentUI/Pill Button Bar/PillButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ open class PillButton: UIButton, TokenizedControlInternal {
}
} else {
setTitle(pillBarItem.title, for: .normal)
titleLabel?.font = .fluent(titleFont)
titleLabel?.font = UIFont.fluent(titleFont, shouldScale: false)

contentEdgeInsets = UIEdgeInsets(top: Constants.topInset,
left: Constants.horizontalInset,
Expand Down Expand Up @@ -219,9 +219,16 @@ open class PillButton: UIButton, TokenizedControlInternal {
private func updateAttributedTitle() {
let itemTitle = pillBarItem.title
var attributedTitle = AttributedString(itemTitle)
attributedTitle.font = .fluent(titleFont)
attributedTitle.font = UIFont.fluent(titleFont, shouldScale: false)
configuration?.attributedTitle = attributedTitle

let attributedTitleTransformer = UIConfigurationTextAttributesTransformer { incoming in
var outgoing = incoming
outgoing.font = UIFont.fluent(self.titleFont, shouldScale: false)
return outgoing
}
configuration?.titleTextAttributesTransformer = attributedTitleTransformer

// Workaround for Apple bug: when UIButton.Configuration is used with UIControl's isSelected = true, accessibilityLabel doesn't get set automatically
accessibilityLabel = itemTitle

Expand Down