Skip to content

Commit f351380

Browse files
authoredMar 30, 2017
Bug 1349355 - Tapping Aa from the Aa context menu causes text to change size (#2571)
1 parent a987241 commit f351380

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎Client/Frontend/Reader/ReaderModeStyleViewController.swift

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import Foundation
66
import UIKit
7+
import Shared
78

89
private struct ReaderModeStyleViewControllerUX {
910
static let RowHeight = 50
@@ -100,6 +101,7 @@ class ReaderModeStyleViewController: UIViewController {
100101

101102
fontSizeButtons = [
102103
FontSizeButton(fontSizeAction: FontSizeAction.smaller),
104+
FontSizeButton(fontSizeAction: FontSizeAction.reset),
103105
FontSizeButton(fontSizeAction: FontSizeAction.bigger)
104106
]
105107

@@ -209,6 +211,8 @@ class ReaderModeStyleViewController: UIViewController {
209211
readerModeStyle.fontSize = readerModeStyle.fontSize.smaller()
210212
case .bigger:
211213
readerModeStyle.fontSize = readerModeStyle.fontSize.bigger()
214+
case .reset:
215+
readerModeStyle.fontSize = ReaderModeFontSize.defaultSize
212216
}
213217
updateFontSizeButtons()
214218
delegate?.readerModeStyleViewController(self, didConfigureStyle: readerModeStyle)
@@ -223,6 +227,8 @@ class ReaderModeStyleViewController: UIViewController {
223227
case .smaller:
224228
button.isEnabled = !readerModeStyle.fontSize.isSmallest()
225229
break
230+
case .reset:
231+
break
226232
}
227233
}
228234
}
@@ -270,6 +276,7 @@ class FontTypeButton: UIButton {
270276

271277
enum FontSizeAction {
272278
case smaller
279+
case reset
273280
case bigger
274281
}
275282

@@ -294,6 +301,8 @@ class FontSizeButton: UIButton {
294301
let largerFontAccessibilityLabel = NSLocalizedString("Increase text size", comment: "Accessibility label for button increasing font size in display settings of reader mode")
295302
setTitle(largerFontLabel, for: UIControlState())
296303
accessibilityLabel = largerFontAccessibilityLabel
304+
case .reset:
305+
accessibilityLabel = Strings.ReaderModeResetFontSizeAccessibilityLabel
297306
}
298307

299308
// TODO Does this need to change with the selected font type? Not sure if makes sense for just +/-

‎Client/Frontend/Strings.swift

+1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ extension Strings {
276276
// Reader Mode.
277277
extension Strings {
278278
public static let ReaderModeAvailableVoiceOverAnnouncement = NSLocalizedString("ReaderMode.Available.VoiceOverAnnouncement", value: "Reader Mode available", comment: "Accessibility message e.g. spoken by VoiceOver when Reader Mode becomes available.")
279+
public static let ReaderModeResetFontSizeAccessibilityLabel = NSLocalizedString("Reset text size", comment: "Accessibility label for button resetting font size in display settings of reader mode")
279280
}
280281

281282
// MARK: Deprecated Strings (to be removed in next version)

0 commit comments

Comments
 (0)
Please sign in to comment.