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

Settings Dynamic Type Fixes #626

Merged
merged 3 commits into from
Mar 6, 2019
Merged

Settings Dynamic Type Fixes #626

merged 3 commits into from
Mar 6, 2019

Conversation

ifbarrera
Copy link
Contributor

@ifbarrera ifbarrera commented Mar 4, 2019

📲 What

Fixes a bug that prevented fonts in settings from resizing correctly with dynamic type. Also turns off font resizing on the LoadingBarButtonItemView since it's a navigation item.

🛠 How

A deep-dive done by @dusi into dynamic type within Settings identified a bug where several labels whose fonts were set using our custom .ksr_() functions were not resizing correctly when the font size was changed using the accessibility inspector. An investigation showed that this was due to the helper styling functions in SettingsStyles.swift capturing the current context which essentially cached the initial preferredFont instead of re-evaluating it every time bindStyles was called.

The solution was to convert the SettingsStyles helpers that are setting a font into a closure that takes a label and applies the styles within the closure.

👀 See

Before:

  • notice that although the section footers resize, the title labels for the settings cells do not
  • notice that the "Save" button resizes even though it shouldn't

After:

  • notice that all cell titles now resize
  • notice that the "Save" button no longer resizes
Before 🐛 After 🦋
y4xlkmeme4 mhnrvh6nhy

♿️ Accessibility

  • Works with VoiceOver
  • Supports Dynamic Type

✅ Acceptance criteria

  • Run the app with the accessibility inspector. Then use the accessibility inspector to increase the font size. Navigate to Settings. Cell titles in all settings cells should now resize.
  • Run the app with the accessibility inspector. Then use the accessibility inspector to increase the font size. Navigate to Settings -> Account -> Change Password. The Save button on the top right should not resize.
  • Run the app with the accessibility inspector. Then use the accessibility inspector to increase the font size. Navigate to Settings -> Account -> Change Email. The Save button on the top right should not resize.

@ifbarrera
Copy link
Contributor Author

@ifbarrera
Copy link
Contributor Author

Copy link
Contributor

@dusi dusi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🚢 🚢

@@ -85,15 +103,3 @@ public func settingsAttributedPlaceholder(_ string: String) -> NSAttributedStrin
attributes: [NSAttributedString.Key.foregroundColor: UIColor.ksr_text_dark_grey_400]
)
}

public func settingsHeaderFooterLabelBaseStyle(_ label: UILabel) -> UILabel {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving these 2 will probably cause some merge conflicts on the Create password branch but now that we know about it we should be able to resolve it just fine!

@ifbarrera ifbarrera merged commit cc8e156 into master Mar 6, 2019
@ifbarrera ifbarrera deleted the save-button-dynamic-type branch March 6, 2019 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants