fomantic-ui 2.9.3-beta.2 → 2.9.3-beta.3
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.
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +1 -1
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +1 -1
- package/dist/components/api.min.js +1 -1
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +6 -6
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.min.css +2 -2
- package/dist/components/calendar.min.js +1 -1
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +1 -1
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +1 -1
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +1 -1
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +11 -4
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +1 -1
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +1 -1
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +24 -20
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +26 -18
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +25 -20
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +1 -1
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +1 -1
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +1 -1
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +1 -1
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +1 -1
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +1 -1
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +1 -1
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +1 -1
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +1 -1
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +1 -1
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +1 -1
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +1 -1
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +1 -1
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +1 -1
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +1 -1
- package/dist/components/state.js +1 -1
- package/dist/components/state.min.js +1 -1
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +1 -1
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +1 -1
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +1 -1
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +1 -1
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +1 -1
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +1 -1
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.min.js +1 -1
- package/dist/semantic.css +58 -58
- package/dist/semantic.js +109 -85
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/src/definitions/behaviors/form.js +25 -17
- package/src/definitions/modules/calendar.less +1 -1
- package/src/definitions/modules/dropdown.js +10 -3
- package/src/definitions/modules/flyout.js +23 -19
- package/src/definitions/modules/modal.js +24 -19
- package/src/definitions/modules/toast.js +1 -1
package/package.json
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
$.fn.form = function (parameters) {
|
23
23
|
var
|
24
24
|
$allModules = $(this),
|
25
|
+
$window = $(window),
|
25
26
|
|
26
27
|
time = Date.now(),
|
27
28
|
performance = [],
|
@@ -60,6 +61,8 @@
|
|
60
61
|
namespace,
|
61
62
|
moduleNamespace,
|
62
63
|
eventNamespace,
|
64
|
+
attachEventsSelector,
|
65
|
+
attachEventsAction,
|
63
66
|
|
64
67
|
submitting = false,
|
65
68
|
dirty = false,
|
@@ -142,6 +145,9 @@
|
|
142
145
|
module[action]();
|
143
146
|
event.preventDefault();
|
144
147
|
});
|
148
|
+
|
149
|
+
attachEventsSelector = selector;
|
150
|
+
attachEventsAction = action;
|
145
151
|
},
|
146
152
|
|
147
153
|
bindEvents: function () {
|
@@ -167,7 +173,7 @@
|
|
167
173
|
|
168
174
|
// Dirty events
|
169
175
|
if (settings.preventLeaving) {
|
170
|
-
$
|
176
|
+
$window.on('beforeunload' + eventNamespace, module.event.beforeUnload);
|
171
177
|
}
|
172
178
|
|
173
179
|
$field.on('change' + eventNamespace
|
@@ -185,6 +191,9 @@
|
|
185
191
|
$module.on('clean' + eventNamespace, function (e) {
|
186
192
|
settings.onClean.call();
|
187
193
|
});
|
194
|
+
if (attachEventsSelector) {
|
195
|
+
module.attachEvents(attachEventsSelector, attachEventsAction);
|
196
|
+
}
|
188
197
|
},
|
189
198
|
|
190
199
|
clear: function () {
|
@@ -233,6 +242,7 @@
|
|
233
242
|
isCheckbox = $field.is(selector.checkbox),
|
234
243
|
isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
|
235
244
|
isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
|
245
|
+
isFile = $field.is(selector.file),
|
236
246
|
isErrored = $fieldGroup.hasClass(className.error)
|
237
247
|
;
|
238
248
|
if (defaultValue === undefined) {
|
@@ -253,7 +263,7 @@
|
|
253
263
|
$calendar.calendar('set date', defaultValue);
|
254
264
|
} else {
|
255
265
|
module.verbose('Resetting field value', $field, defaultValue);
|
256
|
-
$field.val(defaultValue);
|
266
|
+
$field.val(isFile ? '' : defaultValue);
|
257
267
|
}
|
258
268
|
});
|
259
269
|
module.remove.states();
|
@@ -389,6 +399,13 @@
|
|
389
399
|
$module.off(eventNamespace);
|
390
400
|
$field.off(eventNamespace);
|
391
401
|
$submit.off(eventNamespace);
|
402
|
+
if (settings.preventLeaving) {
|
403
|
+
$window.off(eventNamespace);
|
404
|
+
}
|
405
|
+
if (attachEventsSelector) {
|
406
|
+
$(attachEventsSelector).off(eventNamespace);
|
407
|
+
attachEventsSelector = undefined;
|
408
|
+
}
|
392
409
|
},
|
393
410
|
|
394
411
|
event: {
|
@@ -490,18 +507,7 @@
|
|
490
507
|
return rule.type;
|
491
508
|
},
|
492
509
|
changeEvent: function (type, $input) {
|
493
|
-
|
494
|
-
return 'change';
|
495
|
-
}
|
496
|
-
|
497
|
-
return module.get.inputEvent();
|
498
|
-
},
|
499
|
-
inputEvent: function () {
|
500
|
-
return document.createElement('input').oninput !== undefined
|
501
|
-
? 'input'
|
502
|
-
: (document.createElement('input').onpropertychange !== undefined
|
503
|
-
? 'propertychange'
|
504
|
-
: 'keyup');
|
510
|
+
return ['file', 'checkbox', 'radio', 'hidden'].indexOf(type) >= 0 || $input.is('select') ? 'change' : 'input';
|
505
511
|
},
|
506
512
|
fieldsFromShorthand: function (fields) {
|
507
513
|
var
|
@@ -1106,6 +1112,7 @@
|
|
1106
1112
|
$field = module.get.field(key),
|
1107
1113
|
$element = $field.parent(),
|
1108
1114
|
$calendar = $field.closest(selector.uiCalendar),
|
1115
|
+
isFile = $field.is(selector.file),
|
1109
1116
|
isMultiple = Array.isArray(value),
|
1110
1117
|
isCheckbox = $element.is(selector.uiCheckbox) && module.can.useElement('checkbox'),
|
1111
1118
|
isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
|
@@ -1148,7 +1155,7 @@
|
|
1148
1155
|
$calendar.calendar('set date', value);
|
1149
1156
|
} else {
|
1150
1157
|
module.verbose('Setting field value', value, $field);
|
1151
|
-
$field.val(value);
|
1158
|
+
$field.val(isFile ? '' : value);
|
1152
1159
|
}
|
1153
1160
|
}
|
1154
1161
|
});
|
@@ -1651,9 +1658,10 @@
|
|
1651
1658
|
selector: {
|
1652
1659
|
checkbox: 'input[type="checkbox"], input[type="radio"]',
|
1653
1660
|
clear: '.clear',
|
1654
|
-
field: 'input:not(.search):not([type="
|
1661
|
+
field: 'input:not(.search):not([type="reset"]):not([type="button"]):not([type="submit"]), textarea, select',
|
1662
|
+
file: 'input[type="file"]',
|
1655
1663
|
group: '.field',
|
1656
|
-
input: 'input
|
1664
|
+
input: 'input',
|
1657
1665
|
message: '.error.message',
|
1658
1666
|
prompt: '.prompt.label',
|
1659
1667
|
radio: 'input[type="radio"]',
|
@@ -102,7 +102,8 @@
|
|
102
102
|
selectObserver,
|
103
103
|
menuObserver,
|
104
104
|
classObserver,
|
105
|
-
module
|
105
|
+
module,
|
106
|
+
tempDisableApiCache = false
|
106
107
|
;
|
107
108
|
|
108
109
|
module = {
|
@@ -869,11 +870,12 @@
|
|
869
870
|
if (!$module.api('get request')) {
|
870
871
|
module.setup.api();
|
871
872
|
}
|
872
|
-
apiSettings = $.extend(true, {}, apiSettings, settings.apiSettings, apiCallbacks);
|
873
|
+
apiSettings = $.extend(true, {}, apiSettings, settings.apiSettings, apiCallbacks, tempDisableApiCache ? { cache: false } : {});
|
873
874
|
$module
|
874
875
|
.api('setting', apiSettings)
|
875
876
|
.api('query')
|
876
877
|
;
|
878
|
+
tempDisableApiCache = false;
|
877
879
|
},
|
878
880
|
|
879
881
|
filterItems: function (query) {
|
@@ -2399,6 +2401,11 @@
|
|
2399
2401
|
module.set.value('', null, null, preventChangeTrigger);
|
2400
2402
|
},
|
2401
2403
|
|
2404
|
+
clearCache: function () {
|
2405
|
+
module.debug('Clearing API cache once');
|
2406
|
+
tempDisableApiCache = true;
|
2407
|
+
},
|
2408
|
+
|
2402
2409
|
scrollPage: function (direction, $selectedItem) {
|
2403
2410
|
var
|
2404
2411
|
$currentItem = $selectedItem || module.get.selectedItem(),
|
@@ -3449,7 +3456,7 @@
|
|
3449
3456
|
return settings.apiSettings && module.can.useAPI();
|
3450
3457
|
},
|
3451
3458
|
noApiCache: function () {
|
3452
|
-
return settings.apiSettings && !settings.apiSettings.cache;
|
3459
|
+
return tempDisableApiCache || (settings.apiSettings && !settings.apiSettings.cache);
|
3453
3460
|
},
|
3454
3461
|
single: function () {
|
3455
3462
|
return !module.is.multiple();
|
@@ -86,6 +86,7 @@
|
|
86
86
|
initialBodyMargin = '',
|
87
87
|
tempBodyMargin = '',
|
88
88
|
hadScrollbar = false,
|
89
|
+
windowRefocused = false,
|
89
90
|
|
90
91
|
elementNamespace,
|
91
92
|
id,
|
@@ -264,9 +265,13 @@
|
|
264
265
|
module.setup.heights();
|
265
266
|
},
|
266
267
|
focus: function () {
|
267
|
-
|
268
|
+
windowRefocused = true;
|
269
|
+
},
|
270
|
+
click: function (event) {
|
271
|
+
if (windowRefocused && document.activeElement !== event.target && module.is.visible() && settings.autofocus && settings.dimPage && $(document.activeElement).closest(selector.flyout).length === 0) {
|
268
272
|
requestAnimationFrame(module.set.autofocus);
|
269
273
|
}
|
274
|
+
windowRefocused = false;
|
270
275
|
},
|
271
276
|
clickaway: function (event) {
|
272
277
|
if (settings.closable) {
|
@@ -373,6 +378,9 @@
|
|
373
378
|
$window
|
374
379
|
.on('focus' + elementNamespace, module.event.focus)
|
375
380
|
;
|
381
|
+
$context
|
382
|
+
.on('click' + elementNamespace, module.event.click)
|
383
|
+
;
|
376
384
|
},
|
377
385
|
clickaway: function () {
|
378
386
|
module.verbose('Adding clickaway events to context', $context);
|
@@ -502,11 +510,12 @@
|
|
502
510
|
|
503
511
|
return nodes;
|
504
512
|
},
|
505
|
-
shouldRefreshInputs = false
|
513
|
+
shouldRefreshInputs = false,
|
514
|
+
ignoreAutofocus = true
|
506
515
|
;
|
507
516
|
mutations.every(function (mutation) {
|
508
517
|
if (mutation.type === 'attributes') {
|
509
|
-
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
|
518
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
510
519
|
shouldRefreshInputs = true;
|
511
520
|
}
|
512
521
|
} else {
|
@@ -516,6 +525,7 @@
|
|
516
525
|
$removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
517
526
|
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
518
527
|
shouldRefreshInputs = true;
|
528
|
+
ignoreAutofocus = false;
|
519
529
|
}
|
520
530
|
}
|
521
531
|
|
@@ -523,7 +533,7 @@
|
|
523
533
|
});
|
524
534
|
|
525
535
|
if (shouldRefreshInputs) {
|
526
|
-
module.refreshInputs();
|
536
|
+
module.refreshInputs(ignoreAutofocus);
|
527
537
|
}
|
528
538
|
});
|
529
539
|
observer.observe(element, {
|
@@ -548,7 +558,7 @@
|
|
548
558
|
$flyouts = $context.children(selector.flyout);
|
549
559
|
},
|
550
560
|
|
551
|
-
refreshInputs: function () {
|
561
|
+
refreshInputs: function (ignoreAutofocus) {
|
552
562
|
if ($inputs) {
|
553
563
|
$inputs
|
554
564
|
.off('keydown' + elementNamespace)
|
@@ -560,8 +570,8 @@
|
|
560
570
|
$inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
|
561
571
|
return $(this).closest('.disabled').length === 0;
|
562
572
|
});
|
563
|
-
if ($inputs.length === 0) {
|
564
|
-
$inputs = $module;
|
573
|
+
if ($inputs.filter(':input').length === 0) {
|
574
|
+
$inputs = $module.add($inputs);
|
565
575
|
$module.attr('tabindex', -1);
|
566
576
|
} else {
|
567
577
|
$module.removeAttr('tabindex');
|
@@ -572,7 +582,7 @@
|
|
572
582
|
$inputs.last()
|
573
583
|
.on('keydown' + elementNamespace, module.event.inputKeyDown.last)
|
574
584
|
;
|
575
|
-
if (settings.autofocus && $inputs.filter(':focus').length === 0) {
|
585
|
+
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
576
586
|
module.set.autofocus();
|
577
587
|
}
|
578
588
|
},
|
@@ -850,20 +860,14 @@
|
|
850
860
|
var
|
851
861
|
$autofocus = $inputs.filter('[autofocus]'),
|
852
862
|
$rawInputs = $inputs.filter(':input'),
|
853
|
-
$input = $autofocus.length > 0
|
854
|
-
? $autofocus
|
863
|
+
$input = ($autofocus.length > 0
|
864
|
+
? $autofocus
|
855
865
|
: ($rawInputs.length > 0
|
856
866
|
? $rawInputs
|
857
|
-
: $
|
858
|
-
|
867
|
+
: $module)
|
868
|
+
).first()
|
859
869
|
;
|
860
|
-
|
861
|
-
if ($input.length === 0 && $inputs.length > 0) {
|
862
|
-
$input = $inputs.first();
|
863
|
-
}
|
864
|
-
if ($input.length > 0) {
|
865
|
-
$input.trigger('focus');
|
866
|
-
}
|
870
|
+
$input.trigger('focus');
|
867
871
|
},
|
868
872
|
dimmerStyles: function () {
|
869
873
|
if (settings.blurring) {
|
@@ -88,6 +88,7 @@
|
|
88
88
|
tempBodyMargin = '',
|
89
89
|
keepScrollingClass = false,
|
90
90
|
hadScrollbar = false,
|
91
|
+
windowRefocused = false,
|
91
92
|
|
92
93
|
elementEventNamespace,
|
93
94
|
id,
|
@@ -251,6 +252,7 @@
|
|
251
252
|
.off(eventNamespace)
|
252
253
|
;
|
253
254
|
$window.off(elementEventNamespace);
|
255
|
+
$context.off(elementEventNamespace);
|
254
256
|
$dimmer.off(elementEventNamespace);
|
255
257
|
$closeIcon.off(elementEventNamespace);
|
256
258
|
if ($inputs) {
|
@@ -272,11 +274,12 @@
|
|
272
274
|
return nodes;
|
273
275
|
},
|
274
276
|
shouldRefresh = false,
|
275
|
-
shouldRefreshInputs = false
|
277
|
+
shouldRefreshInputs = false,
|
278
|
+
ignoreAutofocus = true
|
276
279
|
;
|
277
280
|
mutations.every(function (mutation) {
|
278
281
|
if (mutation.type === 'attributes') {
|
279
|
-
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
|
282
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
280
283
|
shouldRefreshInputs = true;
|
281
284
|
}
|
282
285
|
} else {
|
@@ -287,6 +290,7 @@
|
|
287
290
|
$removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
288
291
|
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
289
292
|
shouldRefreshInputs = true;
|
293
|
+
ignoreAutofocus = false;
|
290
294
|
}
|
291
295
|
}
|
292
296
|
|
@@ -298,7 +302,7 @@
|
|
298
302
|
module.refresh();
|
299
303
|
}
|
300
304
|
if (shouldRefreshInputs) {
|
301
|
-
module.refreshInputs();
|
305
|
+
module.refreshInputs(ignoreAutofocus);
|
302
306
|
}
|
303
307
|
});
|
304
308
|
observer.observe(element, {
|
@@ -326,7 +330,7 @@
|
|
326
330
|
$allModals = $otherModals.add($module);
|
327
331
|
},
|
328
332
|
|
329
|
-
refreshInputs: function () {
|
333
|
+
refreshInputs: function (ignoreAutofocus) {
|
330
334
|
if ($inputs) {
|
331
335
|
$inputs
|
332
336
|
.off('keydown' + elementEventNamespace)
|
@@ -335,8 +339,8 @@
|
|
335
339
|
$inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
|
336
340
|
return $(this).closest('.disabled').length === 0;
|
337
341
|
});
|
338
|
-
if ($inputs.length === 0) {
|
339
|
-
$inputs = $module;
|
342
|
+
if ($inputs.filter(':input').length === 0) {
|
343
|
+
$inputs = $module.add($inputs);
|
340
344
|
$module.attr('tabindex', -1);
|
341
345
|
} else {
|
342
346
|
$module.removeAttr('tabindex');
|
@@ -347,7 +351,7 @@
|
|
347
351
|
$inputs.last()
|
348
352
|
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
|
349
353
|
;
|
350
|
-
if (settings.autofocus && $inputs.filter(':focus').length === 0) {
|
354
|
+
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
351
355
|
module.set.autofocus();
|
352
356
|
}
|
353
357
|
},
|
@@ -385,6 +389,9 @@
|
|
385
389
|
.on('resize' + elementEventNamespace, module.event.resize)
|
386
390
|
.on('focus' + elementEventNamespace, module.event.focus)
|
387
391
|
;
|
392
|
+
$context
|
393
|
+
.on('click' + elementEventNamespace, module.event.click)
|
394
|
+
;
|
388
395
|
},
|
389
396
|
scrollLock: function () {
|
390
397
|
// touch events default to passive, due to changes in chrome to optimize mobile perf
|
@@ -542,9 +549,13 @@
|
|
542
549
|
}
|
543
550
|
},
|
544
551
|
focus: function () {
|
545
|
-
|
552
|
+
windowRefocused = true;
|
553
|
+
},
|
554
|
+
click: function (event) {
|
555
|
+
if (windowRefocused && document.activeElement !== event.target && $dimmable.dimmer('is active') && module.is.active() && settings.autofocus && $(document.activeElement).closest(selector.modal).length === 0) {
|
546
556
|
requestAnimationFrame(module.set.autofocus);
|
547
557
|
}
|
558
|
+
windowRefocused = false;
|
548
559
|
},
|
549
560
|
},
|
550
561
|
|
@@ -1054,20 +1065,14 @@
|
|
1054
1065
|
var
|
1055
1066
|
$autofocus = $inputs.filter('[autofocus]'),
|
1056
1067
|
$rawInputs = $inputs.filter(':input'),
|
1057
|
-
$input = $autofocus.length > 0
|
1058
|
-
? $autofocus
|
1068
|
+
$input = ($autofocus.length > 0
|
1069
|
+
? $autofocus
|
1059
1070
|
: ($rawInputs.length > 0
|
1060
1071
|
? $rawInputs
|
1061
|
-
: $
|
1062
|
-
|
1072
|
+
: $module)
|
1073
|
+
).first()
|
1063
1074
|
;
|
1064
|
-
|
1065
|
-
if ($input.length === 0 && $inputs.length > 0) {
|
1066
|
-
$input = $inputs.first();
|
1067
|
-
}
|
1068
|
-
if ($input.length > 0) {
|
1069
|
-
$input.trigger('focus');
|
1070
|
-
}
|
1075
|
+
$input.trigger('focus');
|
1071
1076
|
},
|
1072
1077
|
bodyMargin: function () {
|
1073
1078
|
var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
@@ -117,11 +117,11 @@
|
|
117
117
|
if ($toastBox) {
|
118
118
|
module.debug('Removing toast', $toastBox);
|
119
119
|
module.unbind.events();
|
120
|
+
settings.onRemove.call($toastBox, element);
|
120
121
|
$toastBox.remove();
|
121
122
|
$toastBox = undefined;
|
122
123
|
$toast = undefined;
|
123
124
|
$animationObject = undefined;
|
124
|
-
settings.onRemove.call($toastBox, element);
|
125
125
|
$progress = undefined;
|
126
126
|
$progressBar = undefined;
|
127
127
|
$close = undefined;
|