diff --git a/MVMCoreUI/Molecules/RadioButtonWithLabel.swift b/MVMCoreUI/Molecules/RadioButtonWithLabel.swift index 4f42067a..e7a29186 100644 --- a/MVMCoreUI/Molecules/RadioButtonWithLabel.swift +++ b/MVMCoreUI/Molecules/RadioButtonWithLabel.swift @@ -12,7 +12,6 @@ import UIKit public let radioButton = RadioButton() var delegateObject: MVMCoreUIDelegateObject? - var dummyButton: MFCustomButton? let label = Label() // MARK: - Inits @@ -38,10 +37,6 @@ import UIKit radioButton.translatesAutoresizingMaskIntoConstraints = false addSubview(radioButton) - isAccessibilityElement = true - accessibilityTraits = .none - accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") - radioButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor, constant: 0).isActive = true radioButton.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: PaddingOne).isActive = true bottomAnchor.constraint(greaterThanOrEqualTo: radioButton.bottomAnchor, constant: PaddingOne).isActive = true @@ -60,36 +55,12 @@ import UIKit constraint.priority = .defaultHigh constraint.isActive = true } - addActionHandler() } func createRightView() -> ViewConstrainingView? { let rightView = ViewConstrainingView(constrainingView: label) return rightView } - - func addActionHandler() { - - guard dummyButton == nil else { - return - } - - let dummyButton = MFCustomButton(frame: .zero) - self.dummyButton = dummyButton - dummyButton.translatesAutoresizingMaskIntoConstraints = false - addSubview(dummyButton) - NSLayoutConstraint.constraintPinSubview(toSuperview: dummyButton) - bringSubviewToFront(dummyButton) - - dummyButton.add({ [weak self] (button) in - self?.tapAction() - }, for: .touchUpInside) - } - - func tapAction() { - radioButton.tapAction() - changeAccessibilityLabel() - } } // MARK: - MVMCoreUIMoleculeViewProtocol @@ -100,18 +71,6 @@ extension RadioButtonWithLabel { radioButton.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) label.setWithJSON(json?.optionalDictionaryForKey(KeyLabel), delegateObject: delegateObject, - additionalData: additionalData) - changeAccessibilityLabel() - } -} - -// MARK: Accessibility -extension RadioButtonWithLabel { - func changeAccessibilityLabel() { - let stateString = radioButton.isSelected ? "radio_selected_state" : "radio_not_selected_state" - let localizedStringState = MVMCoreUIUtility.hardcodedString(withKey: stateString) ?? "" - let accebilityString = (label.accessibilityLabel ?? (json?.optionalStringForKey("accessibilityText") ?? "")) - + (MVMCoreUIUtility.hardcodedString(withKey: "radio_desc_state") ?? "") + localizedStringState - accessibilityLabel = accebilityString + additionalData: additionalData) } }