-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Stats Revamp] Fixing Scaling Font (Dynamic Type) issues #19790
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Switch to vertical stack view when appropriate - Increase text size
There's a limited space in a header that displays date in a date switcher. Set the maximum font sizes to support limited amount of text increase for a dynamic type.
Using equalSpacing makes long titles go out of bounds. - Use fillEqually for each legend title to take same amount of space - Rebuild legend layout to support fillEqually distribution
Contributor
You can test the changes in Jetpack from this Pull Request by:
|
Contributor
You can test the changes in WordPress from this Pull Request by:
|
sla8c
approved these changes
Dec 21, 2022
Comment on lines
+324
to
+344
| private extension SiteStatsTableHeaderView { | ||
| enum Metrics { | ||
| static let dateLabelFontSize: CGFloat = 20 | ||
| static let maximumDateLabelFontSize: CGFloat = 32 | ||
| static let timezoneFontSize: CGFloat = 16 | ||
| static let maximumTimezoneFontSize: CGFloat = 20 | ||
| static let minimumScaleFactor: CGFloat = 0.8 | ||
|
|
||
| static var dateLabelFont: UIFont { | ||
| let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .headline) | ||
| let font = UIFont(descriptor: fontDescriptor, size: dateLabelFontSize) | ||
| return UIFontMetrics.default.scaledFont(for: font, maximumPointSize: maximumDateLabelFontSize) | ||
| } | ||
|
|
||
| static var timezoneFont: UIFont { | ||
| let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .callout) | ||
| let font = UIFont(descriptor: fontDescriptor, size: timezoneFontSize) | ||
| return UIFontMetrics.default.scaledFont(for: font, maximumPointSize: maximumTimezoneFontSize) | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@staskus nice + I like this encapsulated 👍
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #19728
Issues
The “ACTIVE CARDS” and “INACTIVE CARDS” section headers on the Manage Stats Cards screen overlapping
Fixed by making section height automatic so increasing text sizes would increase section height as well
The chart legends on the segment (circle) chart on detail screens of the Views & Visitors card clipping
To fix legend titles clipping multiple steps were required to take:
traitCollectionDidChange.fillEquallyinstead ofequalCenteringfor legend to long labels wouldn't go out of boundsDonutChatViewto grow in heightThe date pickers used on detail screens to go back and forth between different weeks clipping
Set the maximum size for labels so the date picker header would behave in a similar way as Navigation Bar
The buttons “Try it now” and “Remind me later” on the “upgraded stats” welcome screen don’t respond to text size changes
Enable
adjustsFontForContentSizeCategoryflagTesting instructions
Enable "New Appearance for Stats" and "New Cards for Stats Insights" feature flags
Case 1: "Active Cards" and "Inactive Cards" headers not overlapping:
Case 2: The chart legends on the segment (circle) chart on detail screens of the Views & Visitors card clipping:
Case 3: The date pickers used on detail screens to go back and forth between different weeks.
Case 4: The buttons “Try it now” and “Remind me later” on the “upgraded stats” welcome screen don’t respond to text size changes
Regression Notes
Already existing functionality of changed views breaking
Manual testing
None
PR submission checklist:
RELEASE-NOTES.txtif necessary.