Skip to content

Commit

Permalink
Merge pull request #1252 from TortugaPower/voiceover-chapter
Browse files Browse the repository at this point in the history
Make the chapter title visible for VoiceOver
  • Loading branch information
GianniCarlo authored Feb 10, 2025
2 parents c52ab75 + 3b3a2f8 commit e466e88
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion BookPlayer/Player/Player Screen/PlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ class PlayerViewController: UIViewController, MVVMControllerProtocol, Storyboard
self.chapterTitleButton.titleLabel?.numberOfLines = 2
self.chapterTitleButton.titleLabel?.textAlignment = .center
self.chapterTitleButton.titleLabel?.lineBreakMode = .byWordWrapping
self.chapterTitleButton.isAccessibilityElement = false
/// Disabling traits here, as toggling the chapter context with this button does not have the same feedback
/// like with the `progressButton` action
self.chapterTitleButton.accessibilityTraits = []

// Based on Apple books, the player controls are kept the same for right-to-left languages
self.progressSlider.semanticContentAttribute = .forceLeftToRight
Expand Down Expand Up @@ -191,6 +193,7 @@ class PlayerViewController: UIViewController, MVVMControllerProtocol, Storyboard
}

self.chapterTitleButton.setTitle(progressObject.chapterTitle, for: .normal)
self.chapterTitleButton.accessibilityLabel = progressObject.chapterTitle

if shouldSetSliderValue {
self.progressSlider.setProgress(progressObject.sliderValue)
Expand Down

0 comments on commit e466e88

Please sign in to comment.