]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Adjusted check if the Reveal was closed or another closable within. 8471/head
authorMarius Olbertz <marius.olbertz@gmail.com>
Thu, 5 May 2016 16:37:59 +0000 (18:37 +0200)
committerMarius Olbertz <marius.olbertz@gmail.com>
Thu, 5 May 2016 16:37:59 +0000 (18:37 +0200)
Also added visual test.

js/foundation.reveal.js
test/visual/reveal/reveal-callout.html [new file with mode: 0644]

index 938ea9040db0ba52e1fdf96242b681775a61304d..8199e4b9fd1ea18ee7690d68a1dd1389821fcd11 100644 (file)
@@ -133,8 +133,8 @@ class Reveal {
 
     this.$element.on({
       'open.zf.trigger': this.open.bind(this),
-      'close.zf.trigger': (event, element) => {
-        if (typeof element === 'undefined') { // only close reveal when it's explicitly called
+      'close.zf.trigger': (event, $element) => {
+        if ($(event.target).parents('[data-closable]')[0] === $element) { // only close reveal when it's explicitly called
           return this.close.apply(this);
         }
       },
diff --git a/test/visual/reveal/reveal-callout.html b/test/visual/reveal/reveal-callout.html
new file mode 100644 (file)
index 0000000..c6bba94
--- /dev/null
@@ -0,0 +1,44 @@
+<!doctype html>
+<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
+<html class="no-js" lang="en" dir="ltr">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>Foundation for Sites Testing</title>
+    <link href="../assets/css/foundation.css" rel="stylesheet" />
+  </head>
+  <body>
+    <div class="row column">
+      <h1>Reveal</h1>
+
+      <section>
+        <h2>Callout inside Reveal</h2>
+        <p>Test if a callout inside a Reveal can be closed without closing the Reveal aswell.</p>
+        <div class="reveal" id="exampleModal1" data-reveal>
+          <h2>Closeable callout in reveal bug</h2>
+          <p>When you close the callout, the reveal is closed too, which shouldn't!</p>
+
+          <div class="callout alert" data-closable>
+            <p>Close me now!</p>
+            <button class="close-button" aria-label="Dismiss alert" type="button" data-close>
+              <span aria-hidden="true">&times;</span>
+            </button>
+          </div>
+
+          <button class="close-button" data-close aria-label="Close reveal" type="button">
+            <span aria-hidden="true">&times;</span>
+          </button>
+        </div>
+
+        <p><a data-open="exampleModal1">Click me for a modal</a></p>
+      </section>
+
+    </div>
+
+    <script src="../assets/js/vendor.js"></script>
+    <script src="../assets/js/foundation.js"></script>
+    <script>
+      $(document).foundation();
+    </script>
+  </body>
+</html>