Skip to content

Commit

Permalink
Merge pull request #997 from adevinta/fix/tab-accessibility
Browse files Browse the repository at this point in the history
[Tab] Fix accessibility issues.
  • Loading branch information
michael-zimmermann authored Jun 14, 2024
2 parents 6a7d754 + 695bf38 commit ca88d01
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/Sources/Components/Tab/View/UIKit/TabUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ public final class TabUIView: UIControl {
didSet {
self.viewModel.setIsEnabled(self.isEnabled)
self.segments.forEach{ $0.isEnabled = self.isEnabled }

if self.isEnabled {
self.accessibilityTraits.remove(.notEnabled)
} else {
self.accessibilityTraits.insert(.notEnabled)
}
}
}

Expand Down Expand Up @@ -202,7 +208,7 @@ public final class TabUIView: UIControl {
self.viewModel = TabViewModel(
theme: theme,
apportionsSegmentWidthsByContent: apportionsSegmentWidthsByContent,
content: content,
content: content,
tabSize: tabSize)

super.init(frame: .zero)
Expand Down Expand Up @@ -516,6 +522,7 @@ public final class TabUIView: UIControl {
}

private func setupAccessibility() {
self.accessibilityIdentifier = TabAccessibilityIdentifier.tab
self.accessibilityTraits.insert(.tabBar)
self.isAccessibilityElement = false
self.accessibilityContainerType = .semanticGroup
Expand Down

0 comments on commit ca88d01

Please sign in to comment.