foundation-rails 6.2.0.1 → 6.2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bower.json +2 -2
- data/lib/foundation/rails/version.rb +1 -1
- data/lib/generators/foundation/templates/_settings.scss +2 -1
- data/lib/generators/foundation/templates/foundation_and_overrides.scss +1 -0
- data/vendor/assets/js/foundation.abide.js.es6 +89 -24
- data/vendor/assets/js/foundation.accordion.js.es6 +21 -23
- data/vendor/assets/js/foundation.accordionMenu.js.es6 +12 -11
- data/vendor/assets/js/foundation.core.js.es6 +1 -1
- data/vendor/assets/js/foundation.drilldown.js.es6 +35 -21
- data/vendor/assets/js/foundation.dropdown.js.es6 +8 -3
- data/vendor/assets/js/foundation.dropdownMenu.js.es6 +1 -1
- data/vendor/assets/js/foundation.equalizer.js.es6 +1 -1
- data/vendor/assets/js/foundation.interchange.js.es6 +1 -1
- data/vendor/assets/js/foundation.orbit.js.es6 +2 -1
- data/vendor/assets/js/foundation.responsiveMenu.js.es6 +19 -16
- data/vendor/assets/js/foundation.reveal.js.es6 +29 -15
- data/vendor/assets/js/foundation.slider.js.es6 +19 -3
- data/vendor/assets/js/foundation.toggler.js.es6 +2 -2
- data/vendor/assets/js/foundation.util.box.js.es6 +12 -0
- data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +1 -1
- data/vendor/assets/scss/_global.scss +4 -3
- data/vendor/assets/scss/components/_breadcrumbs.scss +1 -0
- data/vendor/assets/scss/components/_button-group.scss +21 -14
- data/vendor/assets/scss/components/_button.scss +6 -4
- data/vendor/assets/scss/components/_callout.scss +1 -1
- data/vendor/assets/scss/components/_dropdown-menu.scss +2 -3
- data/vendor/assets/scss/components/_flex.scss +1 -1
- data/vendor/assets/scss/components/_media-object.scss +10 -5
- data/vendor/assets/scss/components/_menu.scss +1 -1
- data/vendor/assets/scss/components/_off-canvas.scss +1 -1
- data/vendor/assets/scss/components/_pagination.scss +1 -1
- data/vendor/assets/scss/components/_reveal.scss +2 -1
- data/vendor/assets/scss/components/_switch.scss +1 -1
- data/vendor/assets/scss/components/_table.scss +2 -2
- data/vendor/assets/scss/components/_top-bar.scss +18 -16
- data/vendor/assets/scss/components/_visibility.scss +4 -3
- data/vendor/assets/scss/forms/_checkbox.scss +4 -0
- data/vendor/assets/scss/forms/_input-group.scss +2 -2
- data/vendor/assets/scss/forms/_select.scss +1 -0
- data/vendor/assets/scss/forms/_text.scss +1 -1
- data/vendor/assets/scss/foundation.scss +1 -1
- data/vendor/assets/scss/grid/_flex-grid.scss +9 -7
- data/vendor/assets/scss/grid/_row.scss +2 -1
- data/vendor/assets/scss/settings/_settings.scss +2 -1
- data/vendor/assets/scss/typography/_alignment.scss +1 -1
- data/vendor/assets/scss/util/_breakpoint.scss +8 -6
- data/vendor/assets/scss/util/_mixins.scss +5 -3
- data/vendor/assets/scss/util/_value.scss +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 735a8b397ebc1435c95895db256eabe72558bddc
|
4
|
+
data.tar.gz: b97f18f8a1af0bb11365fce4242b1b774f57d2ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b375d65052824afddfc3a27e683e45bca0e3fe5fa3acc18881fab0ba5a1341c5bdd1915c1f499d3628ed698108e05959717c1c0de72a2d038127259eff3e64
|
7
|
+
data.tar.gz: af520a6d6be8af26d4f1137d6bb64d71b62d4f8c8f35fed8d0e551eb45c1c95036f4b1b7a840214ea1f466cc001e5a2c1b288dd04a0ffc372423f67dfdf99aca
|
data/bower.json
CHANGED
@@ -352,7 +352,7 @@ $input-border: 1px solid $medium-gray;
|
|
352
352
|
$input-border-focus: 1px solid $dark-gray;
|
353
353
|
$input-shadow: inset 0 1px 2px rgba($black, 0.1);
|
354
354
|
$input-shadow-focus: 0 0 5px $medium-gray;
|
355
|
-
$input-cursor-disabled:
|
355
|
+
$input-cursor-disabled: not-allowed;
|
356
356
|
$input-transition: box-shadow 0.5s, border-color 0.25s ease-in-out;
|
357
357
|
$input-number-spinners: true;
|
358
358
|
$input-radius: $global-radius;
|
@@ -564,3 +564,4 @@ $topbar-submenu-background: $topbar-background;
|
|
564
564
|
$topbar-title-spacing: 1rem;
|
565
565
|
$topbar-input-width: 200px;
|
566
566
|
$topbar-unstack-breakpoint: medium;
|
567
|
+
|
@@ -83,11 +83,6 @@ class Abide {
|
|
83
83
|
var isGood = true;
|
84
84
|
|
85
85
|
switch ($el[0].type) {
|
86
|
-
case 'checkbox':
|
87
|
-
case 'radio':
|
88
|
-
isGood = $el[0].checked;
|
89
|
-
break;
|
90
|
-
|
91
86
|
case 'select':
|
92
87
|
case 'select-one':
|
93
88
|
case 'select-multiple':
|
@@ -141,6 +136,28 @@ class Abide {
|
|
141
136
|
return $label;
|
142
137
|
}
|
143
138
|
|
139
|
+
/**
|
140
|
+
* Get the set of labels associated with a set of radio els in this order
|
141
|
+
* 2. The <label> with the attribute `[for="someInputId"]`
|
142
|
+
* 3. The `.closest()` <label>
|
143
|
+
*
|
144
|
+
* @param {Object} $el - jQuery object to check for required attribute
|
145
|
+
* @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
|
146
|
+
*/
|
147
|
+
findRadioLabels($els) {
|
148
|
+
var labels = $els.map((i, el) => {
|
149
|
+
var id = el.id;
|
150
|
+
var $label = this.$element.find(`label[for="${id}"]`);
|
151
|
+
|
152
|
+
if (!$label.length) {
|
153
|
+
$label = $(el).closest('label');
|
154
|
+
}
|
155
|
+
return $label[0];
|
156
|
+
});
|
157
|
+
|
158
|
+
return $(labels);
|
159
|
+
}
|
160
|
+
|
144
161
|
/**
|
145
162
|
* Adds the CSS error class as specified by the Abide settings to the label, input, and the form
|
146
163
|
* @param {Object} $el - jQuery object to add the class to
|
@@ -160,11 +177,39 @@ class Abide {
|
|
160
177
|
$el.addClass(this.options.inputErrorClass).attr('data-invalid', '');
|
161
178
|
}
|
162
179
|
|
180
|
+
/**
|
181
|
+
* Remove CSS error classes etc from an entire radio button group
|
182
|
+
* @param {String} groupName - A string that specifies the name of a radio button group
|
183
|
+
*
|
184
|
+
*/
|
185
|
+
|
186
|
+
removeRadioErrorClasses(groupName) {
|
187
|
+
var $els = this.$element.find(`:radio[name="${groupName}"]`);
|
188
|
+
var $labels = this.findRadioLabels($els);
|
189
|
+
var $formErrors = this.findFormError($els);
|
190
|
+
|
191
|
+
if ($labels.length) {
|
192
|
+
$labels.removeClass(this.options.labelErrorClass);
|
193
|
+
}
|
194
|
+
|
195
|
+
if ($formErrors.length) {
|
196
|
+
$formErrors.removeClass(this.options.formErrorClass);
|
197
|
+
}
|
198
|
+
|
199
|
+
$els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid');
|
200
|
+
|
201
|
+
}
|
202
|
+
|
163
203
|
/**
|
164
204
|
* Removes CSS error class as specified by the Abide settings from the label, input, and the form
|
165
205
|
* @param {Object} $el - jQuery object to remove the class from
|
166
206
|
*/
|
167
207
|
removeErrorClasses($el) {
|
208
|
+
// radios need to clear all of the els
|
209
|
+
if($el[0].type == 'radio') {
|
210
|
+
return this.removeRadioErrorClasses($el.attr('name'));
|
211
|
+
}
|
212
|
+
|
168
213
|
var $label = this.findLabel($el);
|
169
214
|
var $formError = this.findFormError($el);
|
170
215
|
|
@@ -220,6 +265,7 @@ class Abide {
|
|
220
265
|
equalTo = this.options.validators.equalTo($el);
|
221
266
|
}
|
222
267
|
|
268
|
+
|
223
269
|
var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1;
|
224
270
|
var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide';
|
225
271
|
|
@@ -272,37 +318,56 @@ class Abide {
|
|
272
318
|
* @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified
|
273
319
|
*/
|
274
320
|
validateText($el, pattern) {
|
275
|
-
// pattern
|
321
|
+
// A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute
|
276
322
|
pattern = (pattern || $el.attr('pattern') || $el.attr('type'));
|
277
323
|
var inputText = $el.val();
|
324
|
+
var valid = false;
|
325
|
+
|
326
|
+
if (inputText.length) {
|
327
|
+
// If the pattern attribute on the element is in Abide's list of patterns, then test that regexp
|
328
|
+
if (this.options.patterns.hasOwnProperty(pattern)) {
|
329
|
+
valid = this.options.patterns[pattern].test(inputText);
|
330
|
+
}
|
331
|
+
// If the pattern name isn't also the type attribute of the field, then test it as a regexp
|
332
|
+
else if (pattern !== $el.attr('type')) {
|
333
|
+
valid = new RegExp(pattern).test(inputText);
|
334
|
+
}
|
335
|
+
else {
|
336
|
+
valid = true;
|
337
|
+
}
|
338
|
+
}
|
339
|
+
// An empty field is valid if it's not required
|
340
|
+
else if (!$el.prop('required')) {
|
341
|
+
valid = true;
|
342
|
+
}
|
278
343
|
|
279
|
-
|
280
|
-
return inputText.length ?
|
281
|
-
this.options.patterns.hasOwnProperty(pattern) ? this.options.patterns[pattern].test(inputText) :
|
282
|
-
pattern && pattern !== $el.attr('type') ?
|
283
|
-
new RegExp(pattern).test(inputText) :
|
284
|
-
true :
|
285
|
-
true;
|
344
|
+
return valid;
|
286
345
|
}
|
287
346
|
|
288
347
|
/**
|
289
|
-
* Determines whether or a not a radio input is valid based on whether or not it is required and selected
|
348
|
+
* Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group.
|
290
349
|
* @param {String} groupName - A string that specifies the name of a radio button group
|
291
350
|
* @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required)
|
292
351
|
*/
|
293
352
|
validateRadio(groupName) {
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
353
|
+
// If at least one radio in the group has the `required` attribute, the group is considered required
|
354
|
+
// Per W3C spec, all radio buttons in a group should have `required`, but we're being nice
|
355
|
+
var $group = this.$element.find(`:radio[name="${groupName}"]`);
|
356
|
+
var valid = false;
|
357
|
+
|
358
|
+
// .attr() returns undefined if no elements in $group have the attribute "required"
|
359
|
+
if ($group.attr('required') === undefined) {
|
360
|
+
valid = true;
|
361
|
+
}
|
362
|
+
|
363
|
+
// For the group to be valid, at least one radio needs to be checked
|
364
|
+
$group.each((i, e) => {
|
365
|
+
if ($(e).prop('checked')) {
|
366
|
+
valid = true;
|
367
|
+
}
|
303
368
|
});
|
304
369
|
|
305
|
-
return
|
370
|
+
return valid;
|
306
371
|
}
|
307
372
|
|
308
373
|
/**
|
@@ -38,14 +38,11 @@ class Accordion {
|
|
38
38
|
*/
|
39
39
|
_init() {
|
40
40
|
this.$element.attr('role', 'tablist');
|
41
|
-
this.$tabs = this.$element.children('li');
|
42
|
-
if (this.$tabs.length === 0) {
|
43
|
-
this.$tabs = this.$element.children('[data-accordion-item]');
|
44
|
-
}
|
45
|
-
this.$tabs.each(function(idx, el){
|
41
|
+
this.$tabs = this.$element.children('li, [data-accordion-item]');
|
46
42
|
|
43
|
+
this.$tabs.each(function(idx, el) {
|
47
44
|
var $el = $(el),
|
48
|
-
$content = $el.
|
45
|
+
$content = $el.children('[data-tab-content]'),
|
49
46
|
id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'),
|
50
47
|
linkId = el.id || `${id}-label`;
|
51
48
|
|
@@ -56,6 +53,7 @@ class Accordion {
|
|
56
53
|
'aria-expanded': false,
|
57
54
|
'aria-selected': false
|
58
55
|
});
|
56
|
+
|
59
57
|
$content.attr({'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id});
|
60
58
|
});
|
61
59
|
var $initActive = this.$element.find('.is-active').children('[data-tab-content]');
|
@@ -94,10 +92,16 @@ class Accordion {
|
|
94
92
|
_this.toggle($tabContent);
|
95
93
|
},
|
96
94
|
next: function() {
|
97
|
-
$elem.next().find('a').focus()
|
95
|
+
var $a = $elem.next().find('a').focus();
|
96
|
+
if (!_this.options.multiExpand) {
|
97
|
+
$a.trigger('click.zf.accordion')
|
98
|
+
}
|
98
99
|
},
|
99
100
|
previous: function() {
|
100
|
-
$elem.prev().find('a').focus()
|
101
|
+
var $a = $elem.prev().find('a').focus();
|
102
|
+
if (!_this.options.multiExpand) {
|
103
|
+
$a.trigger('click.zf.accordion')
|
104
|
+
}
|
101
105
|
},
|
102
106
|
handled: function() {
|
103
107
|
e.preventDefault();
|
@@ -132,9 +136,8 @@ class Accordion {
|
|
132
136
|
* @function
|
133
137
|
*/
|
134
138
|
down($target, firstTime) {
|
135
|
-
|
136
|
-
|
137
|
-
var $currentActive = this.$element.find('.is-active').children('[data-tab-content]');
|
139
|
+
if (!this.options.multiExpand && !firstTime) {
|
140
|
+
var $currentActive = this.$element.children('.is-active').children('[data-tab-content]');
|
138
141
|
if($currentActive.length){
|
139
142
|
this.up($currentActive);
|
140
143
|
}
|
@@ -146,19 +149,14 @@ class Accordion {
|
|
146
149
|
.addBack()
|
147
150
|
.parent().addClass('is-active');
|
148
151
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
});
|
157
|
-
// });
|
152
|
+
$target.slideDown(this.options.slideSpeed, () => {
|
153
|
+
/**
|
154
|
+
* Fires when the tab is done opening.
|
155
|
+
* @event Accordion#down
|
156
|
+
*/
|
157
|
+
this.$element.trigger('down.zf.accordion', [$target]);
|
158
|
+
});
|
158
159
|
|
159
|
-
// if(!firstTime){
|
160
|
-
// Foundation._reflow(this.$element.attr('data-accordion'));
|
161
|
-
// }
|
162
160
|
$(`#${$target.attr('aria-labelledby')}`).attr({
|
163
161
|
'aria-expanded': true,
|
164
162
|
'aria-selected': true
|
@@ -109,19 +109,19 @@ class AccordionMenu {
|
|
109
109
|
|
110
110
|
$elements.each(function(i) {
|
111
111
|
if ($(this).is($element)) {
|
112
|
-
$prevElement = $elements.eq(Math.max(0, i-1));
|
113
|
-
$nextElement = $elements.eq(Math.min(i+1, $elements.length-1));
|
112
|
+
$prevElement = $elements.eq(Math.max(0, i-1)).find('a').first();
|
113
|
+
$nextElement = $elements.eq(Math.min(i+1, $elements.length-1)).find('a').first();
|
114
114
|
|
115
115
|
if ($(this).children('[data-submenu]:visible').length) { // has open sub menu
|
116
|
-
$nextElement = $element.find('li:first-child');
|
116
|
+
$nextElement = $element.find('li:first-child').find('a').first();
|
117
117
|
}
|
118
118
|
if ($(this).is(':first-child')) { // is first element of sub menu
|
119
|
-
$prevElement = $element.parents('li').first();
|
119
|
+
$prevElement = $element.parents('li').first().find('a').first();
|
120
120
|
} else if ($prevElement.children('[data-submenu]:visible').length) { // if previous element has open sub menu
|
121
|
-
$prevElement = $prevElement.find('li:last-child');
|
121
|
+
$prevElement = $prevElement.find('li:last-child').find('a').first();
|
122
122
|
}
|
123
123
|
if ($(this).is(':last-child')) { // is last element of sub menu
|
124
|
-
$nextElement = $element.parents('li').first().next('li');
|
124
|
+
$nextElement = $element.parents('li').first().next('li').find('a').first();
|
125
125
|
}
|
126
126
|
|
127
127
|
return;
|
@@ -131,7 +131,7 @@ class AccordionMenu {
|
|
131
131
|
open: function() {
|
132
132
|
if ($target.is(':hidden')) {
|
133
133
|
_this.down($target);
|
134
|
-
$target.find('li').first().focus();
|
134
|
+
$target.find('li').first().find('a').first().focus();
|
135
135
|
}
|
136
136
|
},
|
137
137
|
close: function() {
|
@@ -139,14 +139,16 @@ class AccordionMenu {
|
|
139
139
|
_this.up($target);
|
140
140
|
} else if ($element.parent('[data-submenu]').length) { // close currently open sub
|
141
141
|
_this.up($element.parent('[data-submenu]'));
|
142
|
-
$element.parents('li').first().focus();
|
142
|
+
$element.parents('li').first().find('a').first().focus();
|
143
143
|
}
|
144
144
|
},
|
145
145
|
up: function() {
|
146
|
-
$prevElement.focus();
|
146
|
+
$prevElement.attr('tabindex', -1).focus();
|
147
|
+
e.preventDefault();
|
147
148
|
},
|
148
149
|
down: function() {
|
149
|
-
$nextElement.focus();
|
150
|
+
$nextElement.attr('tabindex', -1).focus();
|
151
|
+
e.preventDefault();
|
150
152
|
},
|
151
153
|
toggle: function() {
|
152
154
|
if ($element.children('[data-submenu]').length) {
|
@@ -157,7 +159,6 @@ class AccordionMenu {
|
|
157
159
|
_this.hideAll();
|
158
160
|
},
|
159
161
|
handled: function() {
|
160
|
-
e.preventDefault();
|
161
162
|
e.stopImmediatePropagation();
|
162
163
|
}
|
163
164
|
});
|
@@ -44,9 +44,9 @@ class Drilldown {
|
|
44
44
|
* @private
|
45
45
|
*/
|
46
46
|
_init() {
|
47
|
-
this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent');
|
48
|
-
this.$submenus = this.$submenuAnchors.children('[data-submenu]');
|
49
|
-
this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem');
|
47
|
+
this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a');
|
48
|
+
this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]');
|
49
|
+
this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem').find('a');
|
50
50
|
|
51
51
|
this._prepareMenu();
|
52
52
|
|
@@ -113,7 +113,7 @@ class Drilldown {
|
|
113
113
|
// if(e.target !== e.currentTarget.firstElementChild){
|
114
114
|
// return false;
|
115
115
|
// }
|
116
|
-
_this._show($elem);
|
116
|
+
_this._show($elem.parent('li'));
|
117
117
|
|
118
118
|
if(_this.options.closeOnClick){
|
119
119
|
var $body = $('body').not(_this.$wrapper);
|
@@ -132,9 +132,11 @@ class Drilldown {
|
|
132
132
|
*/
|
133
133
|
_keyboardEvents() {
|
134
134
|
var _this = this;
|
135
|
-
|
135
|
+
|
136
|
+
this.$menuItems.add(this.$element.find('.js-drilldown-back > a')).on('keydown.zf.drilldown', function(e){
|
137
|
+
|
136
138
|
var $element = $(this),
|
137
|
-
$elements = $element.parent('ul').children('li'),
|
139
|
+
$elements = $element.parent('li').parent('ul').children('li').children('a'),
|
138
140
|
$prevElement,
|
139
141
|
$nextElement;
|
140
142
|
|
@@ -145,28 +147,33 @@ class Drilldown {
|
|
145
147
|
return;
|
146
148
|
}
|
147
149
|
});
|
150
|
+
|
148
151
|
Foundation.Keyboard.handleKey(e, 'Drilldown', {
|
149
152
|
next: function() {
|
150
153
|
if ($element.is(_this.$submenuAnchors)) {
|
151
|
-
_this._show($element);
|
152
|
-
$element.
|
153
|
-
$element.find('ul li').filter(_this.$menuItems).first().focus();
|
154
|
+
_this._show($element.parent('li'));
|
155
|
+
$element.parent('li').one(Foundation.transitionend($element), function(){
|
156
|
+
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
|
154
157
|
});
|
158
|
+
e.preventDefault();
|
155
159
|
}
|
156
160
|
},
|
157
161
|
previous: function() {
|
158
|
-
_this._hide($element.parent('ul'));
|
159
|
-
$element.parent('ul').
|
162
|
+
_this._hide($element.parent('li').parent('ul'));
|
163
|
+
$element.parent('li').parent('ul').one(Foundation.transitionend($element), function(){
|
160
164
|
setTimeout(function() {
|
161
|
-
$element.parent('ul').parent('li').focus();
|
165
|
+
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
162
166
|
}, 1);
|
163
167
|
});
|
168
|
+
e.preventDefault();
|
164
169
|
},
|
165
170
|
up: function() {
|
166
171
|
$prevElement.focus();
|
172
|
+
e.preventDefault();
|
167
173
|
},
|
168
174
|
down: function() {
|
169
175
|
$nextElement.focus();
|
176
|
+
e.preventDefault();
|
170
177
|
},
|
171
178
|
close: function() {
|
172
179
|
_this._back();
|
@@ -174,15 +181,22 @@ class Drilldown {
|
|
174
181
|
},
|
175
182
|
open: function() {
|
176
183
|
if (!$element.is(_this.$menuItems)) { // not menu item means back button
|
177
|
-
_this._hide($element.parent('ul'));
|
178
|
-
|
184
|
+
_this._hide($element.parent('li').parent('ul'));
|
185
|
+
$element.parent('li').parent('ul').one(Foundation.transitionend($element), function(){
|
186
|
+
setTimeout(function() {
|
187
|
+
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
188
|
+
}, 1);
|
189
|
+
});
|
190
|
+
e.preventDefault();
|
179
191
|
} else if ($element.is(_this.$submenuAnchors)) {
|
180
|
-
_this._show($element);
|
181
|
-
|
192
|
+
_this._show($element.parent('li'));
|
193
|
+
$element.parent('li').one(Foundation.transitionend($element), function(){
|
194
|
+
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
|
195
|
+
});
|
196
|
+
e.preventDefault();
|
182
197
|
}
|
183
198
|
},
|
184
199
|
handled: function() {
|
185
|
-
e.preventDefault();
|
186
200
|
e.stopImmediatePropagation();
|
187
201
|
}
|
188
202
|
});
|
@@ -244,7 +258,7 @@ class Drilldown {
|
|
244
258
|
* Opens a submenu.
|
245
259
|
* @function
|
246
260
|
* @fires Drilldown#open
|
247
|
-
* @param {jQuery} $elem - the current element with a submenu to open.
|
261
|
+
* @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag.
|
248
262
|
*/
|
249
263
|
_show($elem) {
|
250
264
|
$elem.children('[data-submenu]').addClass('is-active');
|
@@ -256,7 +270,7 @@ class Drilldown {
|
|
256
270
|
* Hides a submenu
|
257
271
|
* @function
|
258
272
|
* @fires Drilldown#hide
|
259
|
-
* @param {jQuery} $elem - the current sub-menu to hide.
|
273
|
+
* @param {jQuery} $elem - the current sub-menu to hide, i.e. the `ul` tag.
|
260
274
|
*/
|
261
275
|
_hide($elem) {
|
262
276
|
var _this = this;
|
@@ -319,7 +333,7 @@ Drilldown.defaults = {
|
|
319
333
|
* @option
|
320
334
|
* @example '<\li><\a>Back<\/a><\/li>'
|
321
335
|
*/
|
322
|
-
backButton: '<li class="js-drilldown-back"><a>Back</a></li>',
|
336
|
+
backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>',
|
323
337
|
/**
|
324
338
|
* Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting.
|
325
339
|
* @option
|
@@ -344,4 +358,4 @@ Drilldown.defaults = {
|
|
344
358
|
// Window exports
|
345
359
|
Foundation.plugin(Drilldown, 'Drilldown');
|
346
360
|
|
347
|
-
}(jQuery);
|
361
|
+
}(jQuery);
|