diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js index c7ad2fd..a297be5 100644 --- a/core/misc/vertical-tabs.js +++ b/core/misc/vertical-tabs.js @@ -115,12 +115,16 @@ Drupal.verticalTab = function (settings) { var self = this; $.extend(this, settings, Drupal.theme('verticalTab', settings)); + // Get the ID of the tab pane element. + var detailsId = settings.details.attr('id'); - this.link.attr('href', '#' + settings.details.attr('id')); + this.link.attr('href', '#' + detailsId); this.link.on('click', function (e) { e.preventDefault(); self.focus(); + // Update the URL bar with the hash. + window.location.hash = detailsId; }); // Keyboard events added: @@ -129,6 +133,8 @@ if (event.keyCode === 13) { event.preventDefault(); self.focus(); + // Update the URL bar with the hash. + window.location.hash = detailsId; // Set focus on the first input field of the visible details/tab pane. $('.vertical-tabs__pane :input:visible:enabled').eq(0).trigger('focus'); }