     }
 
     // MARK: - Private
+
+    @objc
+    private func handleHardwareReturnKey() {
+        if let preferredAction = self.preferredAction {
+            self.alert.actionTappedHandler?(preferredAction)
+        }
+    }
 
     private func listenForKeyboardChanges() {
         NotificationCenter.default.addObserver(self, selector: #selector(keyboardChange),

        self.configureAlertView()
    }

    public override var preferredStatusBarStyle: UIStatusBarStyle {
        return self.presentingViewController?.preferredStatusBarStyle ?? .default
    }

    private func commonInit() {
        self.modalPresentationStyle = .custom
        self.transitioningDelegate = self.transitionDelegate

        if self.preferredStyle == .alert {
            let command = UIKeyCommand(input: "\r", modifierFlags: [],
                                       action: #selector(self.handleHardwareReturnKey))
            self.addKeyCommand(command)
        }
    }

    // MARK: - Public
