File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 6
6
( function ( $ , window , Drupal , drupalSettings ) {
7
7
"use strict" ;
8
8
9
+ /**
10
+ * Show the parent vertical tab pane of a targeted page fragment.
11
+ *
12
+ * In order to make sure a targeted element inside a vertical tab pane is
13
+ * visible on a hash change or fragment link click, show all parent panes.
14
+ *
15
+ * @param {jQuery.Event } e
16
+ * The event triggered.
17
+ * @param {jQuery } $target
18
+ * The targeted node as a jQuery object.
19
+ */
20
+ var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange ( e , $target ) {
21
+ $target . parents ( '.vertical-tabs-pane' ) . each ( function ( index , pane ) {
22
+ $ ( pane ) . data ( 'verticalTab' ) . focus ( ) ;
23
+ } ) ;
24
+ } ;
25
+
9
26
/**
10
27
* This script transforms a set of details into a stack of vertical
11
28
* tabs. Another tab pane can be selected by clicking on the respective
26
43
return ;
27
44
}
28
45
46
+ /**
47
+ * Binds a listener to handle fragment link clicks and URL hash changes.
48
+ */
49
+ $ ( 'body' ) . once ( 'vertical-tabs-fragments' ) . on ( 'formFragmentLinkClickOrHashChange.verticalTabs' , handleFragmentLinkClickOrHashChange ) ;
50
+
29
51
$ ( context ) . find ( '[data-vertical-tabs-panes]' ) . once ( 'vertical-tabs' ) . each ( function ( ) {
30
52
var $this = $ ( this ) . addClass ( 'tab-content vertical-tabs-panes' ) ;
31
53
You can’t perform that action at this time.
0 commit comments