             viewControllerToShow = navigationController
             viewControllerToShow.modalPresentationStyle = .formSheet
         }
+
+        // Dismiss any other modals that may be visible
+        dismiss(animated: true, completion: nil)
 
         present(viewControllerToShow, animated: true, completion: nil)
         configurePopover(viewController: viewControllerToShow, sourceView: colorButton)

        alert.addAction(cancelAction)
        alert.modalPresentationStyle = .popover

        present(alert, animated: true, completion: nil)
        configurePopover(viewController: alert, sourceView: clearButton)
    }

            viewControllerToShow = navigationController
            viewControllerToShow.modalPresentationStyle = .formSheet
        }

        // Dismiss any other modals that may be visible
        dismiss(animated: true, completion: nil)

        self.present(viewControllerToShow, animated: true, completion: nil)
        configurePopover(viewController: viewControllerToShow, sourceView: helpButton)
