diff --git a/formatters/tabs/tabs.js b/formatters/tabs/tabs.js
index 9e1bdb4..58a5c0b 100644
--- a/formatters/tabs/tabs.js
+++ b/formatters/tabs/tabs.js
@@ -43,4 +43,33 @@
     }
   };
 
+  Drupal.behaviors.showTabWithError = {
+    attach: function (context, settings) {
+      if (typeof $('<input>')[0].checkValidity == 'function') { // Check if browser supports HTML5 validation
+        $('.form-submit:not([formnovalidate])').once('showTabWithError').on('click', function() { // Can't use .submit() because HTML validation prevents it from running
+          var $this = $(this),
+              $form = $this.closest('form'); // Get form of the submit button
+
+          // Support themes where the submit button is separated from the form like the Gin theme.
+          if ($form.length === 0) {
+            let $header = $this.closest('header');
+            if ($header.hasClass('region-sticky')) {
+              $form = $header.siblings().find('.region-content form');
+            }
+          }
+
+          if (typeof $form[0] !== 'undefined') {
+            $($form[0].elements).each(function () {
+              if (this.checkValidity && !this.checkValidity()) { // First check for details element
+                var id = $(this).closest('.field-group-tab').attr('id'); // Get wrapper's id
+                $('[href="#' + id + '"]').click(); // Click menu item with id
+                return false; // Break loop after first error
+              }
+            });
+          }
+        });
+      }
+    }
+  };
+
 })(jQuery, Modernizr);
