fomantic-ui 2.9.0-beta.318 → 2.9.0-beta.319

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.
Files changed (162) hide show
  1. package/dist/components/accordion.css +1 -1
  2. package/dist/components/accordion.js +1 -1
  3. package/dist/components/accordion.min.css +1 -1
  4. package/dist/components/accordion.min.js +1 -1
  5. package/dist/components/ad.css +1 -1
  6. package/dist/components/ad.min.css +1 -1
  7. package/dist/components/api.js +1 -1
  8. package/dist/components/api.min.js +1 -1
  9. package/dist/components/breadcrumb.css +1 -1
  10. package/dist/components/breadcrumb.min.css +1 -1
  11. package/dist/components/button.css +1 -1
  12. package/dist/components/button.min.css +1 -1
  13. package/dist/components/calendar.css +1 -1
  14. package/dist/components/calendar.js +1 -1
  15. package/dist/components/calendar.min.css +1 -1
  16. package/dist/components/calendar.min.js +1 -1
  17. package/dist/components/card.css +1 -1
  18. package/dist/components/card.min.css +1 -1
  19. package/dist/components/checkbox.css +1 -1
  20. package/dist/components/checkbox.js +1 -1
  21. package/dist/components/checkbox.min.css +1 -1
  22. package/dist/components/checkbox.min.js +1 -1
  23. package/dist/components/comment.css +1 -1
  24. package/dist/components/comment.min.css +1 -1
  25. package/dist/components/container.css +1 -1
  26. package/dist/components/container.min.css +1 -1
  27. package/dist/components/dimmer.css +1 -1
  28. package/dist/components/dimmer.js +1 -1
  29. package/dist/components/dimmer.min.css +1 -1
  30. package/dist/components/dimmer.min.js +1 -1
  31. package/dist/components/divider.css +1 -1
  32. package/dist/components/divider.min.css +1 -1
  33. package/dist/components/dropdown.css +1 -1
  34. package/dist/components/dropdown.js +1 -1
  35. package/dist/components/dropdown.min.css +1 -1
  36. package/dist/components/dropdown.min.js +1 -1
  37. package/dist/components/embed.css +1 -1
  38. package/dist/components/embed.js +1 -1
  39. package/dist/components/embed.min.css +1 -1
  40. package/dist/components/embed.min.js +1 -1
  41. package/dist/components/feed.css +1 -1
  42. package/dist/components/feed.min.css +1 -1
  43. package/dist/components/flag.css +1 -1
  44. package/dist/components/flag.min.css +1 -1
  45. package/dist/components/flyout.css +57 -23
  46. package/dist/components/flyout.js +217 -31
  47. package/dist/components/flyout.min.css +2 -2
  48. package/dist/components/flyout.min.js +2 -2
  49. package/dist/components/form.css +1 -1
  50. package/dist/components/form.js +1 -1
  51. package/dist/components/form.min.css +1 -1
  52. package/dist/components/form.min.js +1 -1
  53. package/dist/components/grid.css +1 -1
  54. package/dist/components/grid.min.css +1 -1
  55. package/dist/components/header.css +1 -1
  56. package/dist/components/header.min.css +1 -1
  57. package/dist/components/icon.css +1 -1
  58. package/dist/components/icon.min.css +1 -1
  59. package/dist/components/image.css +1 -1
  60. package/dist/components/image.min.css +1 -1
  61. package/dist/components/input.css +1 -1
  62. package/dist/components/input.min.css +1 -1
  63. package/dist/components/item.css +1 -1
  64. package/dist/components/item.min.css +1 -1
  65. package/dist/components/label.css +1 -1
  66. package/dist/components/label.min.css +1 -1
  67. package/dist/components/list.css +1 -1
  68. package/dist/components/list.min.css +1 -1
  69. package/dist/components/loader.css +1 -1
  70. package/dist/components/loader.min.css +1 -1
  71. package/dist/components/message.css +1 -1
  72. package/dist/components/message.min.css +1 -1
  73. package/dist/components/modal.css +6 -6
  74. package/dist/components/modal.js +1 -1
  75. package/dist/components/modal.min.css +2 -2
  76. package/dist/components/modal.min.js +1 -1
  77. package/dist/components/nag.css +1 -1
  78. package/dist/components/nag.js +1 -1
  79. package/dist/components/nag.min.css +1 -1
  80. package/dist/components/nag.min.js +1 -1
  81. package/dist/components/placeholder.css +1 -1
  82. package/dist/components/placeholder.min.css +1 -1
  83. package/dist/components/popup.css +1 -1
  84. package/dist/components/popup.js +1 -1
  85. package/dist/components/popup.min.css +1 -1
  86. package/dist/components/popup.min.js +1 -1
  87. package/dist/components/progress.css +1 -1
  88. package/dist/components/progress.js +1 -1
  89. package/dist/components/progress.min.css +1 -1
  90. package/dist/components/progress.min.js +1 -1
  91. package/dist/components/rail.css +1 -1
  92. package/dist/components/rail.min.css +1 -1
  93. package/dist/components/rating.css +1 -1
  94. package/dist/components/rating.js +1 -1
  95. package/dist/components/rating.min.css +1 -1
  96. package/dist/components/rating.min.js +1 -1
  97. package/dist/components/reset.css +1 -1
  98. package/dist/components/reset.min.css +1 -1
  99. package/dist/components/reveal.css +1 -1
  100. package/dist/components/reveal.min.css +1 -1
  101. package/dist/components/search.css +1 -1
  102. package/dist/components/search.js +1 -1
  103. package/dist/components/search.min.css +1 -1
  104. package/dist/components/search.min.js +1 -1
  105. package/dist/components/segment.css +1 -1
  106. package/dist/components/segment.min.css +1 -1
  107. package/dist/components/shape.css +1 -1
  108. package/dist/components/shape.js +1 -1
  109. package/dist/components/shape.min.css +1 -1
  110. package/dist/components/shape.min.js +1 -1
  111. package/dist/components/sidebar.css +11 -3
  112. package/dist/components/sidebar.js +27 -7
  113. package/dist/components/sidebar.min.css +2 -2
  114. package/dist/components/sidebar.min.js +2 -2
  115. package/dist/components/site.css +1 -1
  116. package/dist/components/site.js +1 -1
  117. package/dist/components/site.min.css +1 -1
  118. package/dist/components/site.min.js +1 -1
  119. package/dist/components/slider.js +1 -1
  120. package/dist/components/slider.min.js +1 -1
  121. package/dist/components/state.js +1 -1
  122. package/dist/components/state.min.js +1 -1
  123. package/dist/components/statistic.css +1 -1
  124. package/dist/components/statistic.min.css +1 -1
  125. package/dist/components/step.css +1 -1
  126. package/dist/components/step.min.css +1 -1
  127. package/dist/components/sticky.css +1 -1
  128. package/dist/components/sticky.js +1 -1
  129. package/dist/components/sticky.min.css +1 -1
  130. package/dist/components/sticky.min.js +1 -1
  131. package/dist/components/tab.css +1 -1
  132. package/dist/components/tab.js +1 -1
  133. package/dist/components/tab.min.css +1 -1
  134. package/dist/components/tab.min.js +1 -1
  135. package/dist/components/table.css +1 -1
  136. package/dist/components/table.min.css +1 -1
  137. package/dist/components/text.css +1 -1
  138. package/dist/components/text.min.css +1 -1
  139. package/dist/components/toast.css +1 -1
  140. package/dist/components/toast.js +1 -1
  141. package/dist/components/toast.min.css +1 -1
  142. package/dist/components/toast.min.js +1 -1
  143. package/dist/components/transition.css +1 -1
  144. package/dist/components/transition.js +1 -1
  145. package/dist/components/transition.min.css +1 -1
  146. package/dist/components/transition.min.js +1 -1
  147. package/dist/components/visibility.js +1 -1
  148. package/dist/components/visibility.min.js +1 -1
  149. package/dist/semantic.css +133 -78
  150. package/dist/semantic.js +268 -62
  151. package/dist/semantic.min.css +2 -2
  152. package/dist/semantic.min.js +2 -2
  153. package/package.json +1 -1
  154. package/src/definitions/modules/flyout.js +216 -30
  155. package/src/definitions/modules/flyout.less +114 -68
  156. package/src/definitions/modules/modal.less +3 -3
  157. package/src/definitions/modules/sidebar.js +26 -6
  158. package/src/definitions/modules/sidebar.less +11 -0
  159. package/src/themes/default/globals/variation.variables +8 -0
  160. package/src/themes/default/modules/flyout.variables +56 -1
  161. package/src/themes/default/modules/modal.variables +2 -2
  162. package/src/themes/default/modules/sidebar.variables +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fomantic-ui",
3
- "version": "2.9.0-beta.318+01b81c0",
3
+ "version": "2.9.0-beta.319+0740de8",
4
4
  "description": "Fomantic empowers designers and developers by creating a shared vocabulary for UI.",
5
5
  "keywords": [
6
6
  "fomantic-ui",
@@ -68,8 +68,10 @@ $.flyout = $.fn.flyout = function(parameters) {
68
68
  moduleNamespace = 'module-' + namespace,
69
69
 
70
70
  $module = $(this),
71
- $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $body,
72
- $close = $module.find(selector.close),
71
+ $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
72
+ $closeIcon = $module.find(selector.close),
73
+ $inputs,
74
+ $focusedElement,
73
75
 
74
76
  $flyouts = $module.children(selector.flyout),
75
77
  $pusher = $context.children(selector.pusher),
@@ -88,6 +90,7 @@ $.flyout = $.fn.flyout = function(parameters) {
88
90
 
89
91
  elementNamespace,
90
92
  id,
93
+ observer,
91
94
  currentScroll,
92
95
  transitionEvent,
93
96
 
@@ -99,6 +102,7 @@ $.flyout = $.fn.flyout = function(parameters) {
99
102
  initialize: function() {
100
103
  module.debug('Initializing flyout', parameters);
101
104
 
105
+ module.create.id();
102
106
  if(!isFlyoutComponent) {
103
107
  module.create.flyout();
104
108
  if(!$.isFunction(settings.onHidden)) {
@@ -127,13 +131,14 @@ $.flyout = $.fn.flyout = function(parameters) {
127
131
  }
128
132
  settings.actions.forEach(function (el) {
129
133
  var
130
- icon = el[fields.icon] ? '<i class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
134
+ icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
131
135
  text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
132
136
  cls = module.helpers.deQuote(el[fields.class] || ''),
133
137
  click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {}
134
138
  ;
135
139
  $actions.append($('<button/>', {
136
140
  html: icon + text,
141
+ 'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g,''),
137
142
  class: className.button + ' ' + cls,
138
143
  click: function () {
139
144
  if (click.call(element, $module) === false) {
@@ -145,8 +150,6 @@ $.flyout = $.fn.flyout = function(parameters) {
145
150
  });
146
151
  }
147
152
 
148
- module.create.id();
149
-
150
153
  transitionEvent = module.get.transitionEvent();
151
154
 
152
155
  // avoids locking rendering if initialized in onReady
@@ -165,6 +168,9 @@ $.flyout = $.fn.flyout = function(parameters) {
165
168
  module.setup.heights();
166
169
  module.bind.resize();
167
170
  }
171
+ module.refreshInputs();
172
+ module.bind.events();
173
+ module.observeChanges();
168
174
  module.instantiate();
169
175
 
170
176
  if(settings.autoShow){
@@ -183,30 +189,37 @@ $.flyout = $.fn.flyout = function(parameters) {
183
189
  create: {
184
190
  flyout: function() {
185
191
  module.verbose('Programmaticaly create flyout', $context);
186
- $module = $('<div/>', {class: className.flyout});
192
+ $module = $('<div/>', {class: className.flyout, role: 'dialog', 'aria-modal': settings.dimPage});
187
193
  if (settings.closeIcon) {
188
- $close = $('<i/>', {class: className.close})
189
- $module.append($close);
194
+ $closeIcon = $('<i/>', {class: className.close, role: 'button', tabindex: 0, 'aria-label': settings.text.close})
195
+ $module.append($closeIcon);
190
196
  }
191
197
  if (settings.title !== '') {
192
- $('<div/>', {class: className.header}).appendTo($module);
198
+ var titleId = '_' + module.get.id() + 'title';
199
+ $module.attr('aria-labelledby', titleId);
200
+ $('<div/>', {class: className.header, id: titleId}).appendTo($module);
193
201
  }
194
202
  if (settings.content !== '') {
195
- $('<div/>', {class: className.content}).appendTo($module);
203
+ var descId = '_' + module.get.id() + 'desc';
204
+ $module.attr('aria-describedby', descId);
205
+ $('<div/>', {class: className.content, id: descId}).appendTo($module);
196
206
  }
197
207
  if (module.has.configActions()) {
198
208
  $('<div/>', {class: className.actions}).appendTo($module);
199
209
  }
200
- $context.append($module);
210
+ $module.prependTo($context);
201
211
  },
202
212
  id: function() {
203
- id = (Math.random().toString(16) + '000000000').substr(2,8);
213
+ id = (Math.random().toString(16) + '000000000').slice(2, 10);
204
214
  elementNamespace = '.' + id;
205
215
  module.verbose('Creating unique id for element', id);
206
216
  }
207
217
  },
208
218
 
209
219
  destroy: function() {
220
+ if (observer) {
221
+ observer.disconnect();
222
+ }
210
223
  module.verbose('Destroying previous module for', $module);
211
224
  $module
212
225
  .off(eventNamespace)
@@ -215,6 +228,10 @@ $.flyout = $.fn.flyout = function(parameters) {
215
228
  if(module.is.ios()) {
216
229
  module.remove.ios();
217
230
  }
231
+ $closeIcon.off(elementNamespace);
232
+ if($inputs) {
233
+ $inputs.off(elementNamespace);
234
+ }
218
235
  // bound by uuid
219
236
  $context.off(elementNamespace);
220
237
  $window.off(elementNamespace);
@@ -222,6 +239,21 @@ $.flyout = $.fn.flyout = function(parameters) {
222
239
  },
223
240
 
224
241
  event: {
242
+ keyboard: function(event) {
243
+ var
244
+ keyCode = event.which
245
+ ;
246
+ if(keyCode === settings.keys.escape) {
247
+ if(settings.closable) {
248
+ module.debug('Escape key pressed hiding flyout');
249
+ module.hide();
250
+ }
251
+ else {
252
+ module.debug('Escape key pressed, but closable is set to false');
253
+ }
254
+ event.preventDefault();
255
+ }
256
+ },
225
257
  resize: function() {
226
258
  module.setup.heights();
227
259
  },
@@ -244,6 +276,34 @@ $.flyout = $.fn.flyout = function(parameters) {
244
276
  close: function(event) {
245
277
  module.hide();
246
278
  },
279
+ closeKeyUp: function(event){
280
+ var
281
+ keyCode = event.which
282
+ ;
283
+ if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
284
+ module.hide();
285
+ }
286
+ },
287
+ inputKeyDown: {
288
+ first: function(event) {
289
+ var
290
+ keyCode = event.which
291
+ ;
292
+ if (keyCode === settings.keys.tab && event.shiftKey) {
293
+ $inputs.last().focus();
294
+ event.preventDefault();
295
+ }
296
+ },
297
+ last: function(event) {
298
+ var
299
+ keyCode = event.which
300
+ ;
301
+ if (keyCode === settings.keys.tab && !event.shiftKey) {
302
+ $inputs.first().focus();
303
+ event.preventDefault();
304
+ }
305
+ }
306
+ },
247
307
  approve: function(event) {
248
308
  if (ignoreRepeatedEvents || settings.onApprove.call(module.element, $(this)) === false) {
249
309
  module.verbose('Approve callback returned false cancelling close');
@@ -287,16 +347,23 @@ $.flyout = $.fn.flyout = function(parameters) {
287
347
  module.verbose('Adding resize event to window', $window);
288
348
  $window.on('resize' + elementNamespace, module.event.resize);
289
349
  },
350
+ events: function() {
351
+ module.verbose('Attaching events');
352
+ $module
353
+ .on('click' + eventNamespace, selector.close, module.event.close)
354
+ .on('click' + eventNamespace, selector.approve, module.event.approve)
355
+ .on('click' + eventNamespace, selector.deny, module.event.deny)
356
+ ;
357
+ $closeIcon
358
+ .on('keyup' + elementNamespace, module.event.closeKeyUp)
359
+ ;
360
+ },
290
361
  clickaway: function() {
291
362
  module.verbose('Adding clickaway events to context', $context);
292
363
  $context
293
364
  .on('click' + elementNamespace, module.event.clickaway)
294
365
  .on('touchend' + elementNamespace, module.event.clickaway)
295
366
  ;
296
-
297
- $module.on('click' + elementNamespace, settings.selector.close, module.event.close);
298
- $module.on('click' + elementNamespace, settings.selector.approve, module.event.approve);
299
- $module.on('click' + elementNamespace, settings.selector.deny, module.event.deny);
300
367
  },
301
368
  scrollLock: function() {
302
369
  if(settings.scrollLock) {
@@ -383,7 +450,7 @@ $.flyout = $.fn.flyout = function(parameters) {
383
450
  if(direction === 'left' || direction === 'right') {
384
451
  module.debug('Adding CSS rules for animation distance', width);
385
452
  style += ''
386
- + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher:after {'
453
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
387
454
  + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
388
455
  + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
389
456
  + ' }'
@@ -391,7 +458,7 @@ $.flyout = $.fn.flyout = function(parameters) {
391
458
  }
392
459
  else if(direction === 'top' || direction == 'bottom') {
393
460
  style += ''
394
- + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher:after {'
461
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
395
462
  + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
396
463
  + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
397
464
  + ' }'
@@ -399,8 +466,8 @@ $.flyout = $.fn.flyout = function(parameters) {
399
466
  }
400
467
  /* opposite sides visible forces content overlay */
401
468
  style += ''
402
- + ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher:after,'
403
- + ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher:after {'
469
+ + ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after,'
470
+ + ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after {'
404
471
  + ' -webkit-transform: translate3d(0, 0, 0);'
405
472
  + ' transform: translate3d(0, 0, 0);'
406
473
  + ' }'
@@ -411,13 +478,30 @@ $.flyout = $.fn.flyout = function(parameters) {
411
478
  .appendTo($head)
412
479
  ;
413
480
  module.debug('Adding sizing css to head', $style);
481
+ },
482
+ keyboardShortcuts: function() {
483
+ module.verbose('Adding keyboard shortcuts');
484
+ $document
485
+ .on('keydown' + eventNamespace, module.event.keyboard)
486
+ ;
487
+ }
488
+ },
489
+ observeChanges: function() {
490
+ if('MutationObserver' in window) {
491
+ observer = new MutationObserver(function(mutations) {
492
+ module.refreshInputs();
493
+ });
494
+ observer.observe(element, {
495
+ childList : true,
496
+ subtree : true
497
+ });
498
+ module.debug('Setting up mutation observer', observer);
414
499
  }
415
500
  },
416
-
417
501
  refresh: function() {
418
502
  module.verbose('Refreshing selector cache');
419
- $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
420
- $flyouts = $context.children(selector.flyout);
503
+ $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
504
+ module.refreshFlyouts();
421
505
  $pusher = $context.children(selector.pusher);
422
506
  module.clear.cache();
423
507
  },
@@ -427,6 +511,26 @@ $.flyout = $.fn.flyout = function(parameters) {
427
511
  $flyouts = $context.children(selector.flyout);
428
512
  },
429
513
 
514
+ refreshInputs: function(){
515
+ if($inputs){
516
+ $inputs
517
+ .off('keydown' + elementNamespace)
518
+ ;
519
+ }
520
+ if(!settings.dimPage){
521
+ return;
522
+ }
523
+ $inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
524
+ return $(this).closest('.disabled').length === 0;
525
+ });
526
+ $inputs.first()
527
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.first)
528
+ ;
529
+ $inputs.last()
530
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.last)
531
+ ;
532
+ },
533
+
430
534
  setup: {
431
535
  cache: function() {
432
536
  module.cache = {
@@ -496,7 +600,10 @@ $.flyout = $.fn.flyout = function(parameters) {
496
600
  : function(){}
497
601
  ;
498
602
  if(module.is.hidden()) {
499
- module.refreshFlyouts();
603
+ if(settings.onShow.call(element) === false) {
604
+ module.verbose('Show callback returned false cancelling show');
605
+ return;
606
+ }
500
607
  module.refresh();
501
608
  if(module.othersActive()) {
502
609
  module.debug('Other flyouts currently visible');
@@ -506,12 +613,19 @@ $.flyout = $.fn.flyout = function(parameters) {
506
613
  ignoreRepeatedEvents = false;
507
614
  }
508
615
  }
616
+ module.set.dimmerStyles();
509
617
  module.pushPage(function() {
510
618
  callback.call(element);
511
- settings.onShow.call(element);
619
+ settings.onVisible.call(element);
620
+ if(settings.keyboardShortcuts) {
621
+ module.add.keyboardShortcuts();
622
+ }
623
+ module.save.focus();
624
+ if(settings.autofocus) {
625
+ module.set.autofocus();
626
+ }
512
627
  });
513
628
  settings.onChange.call(element);
514
- settings.onVisible.call(element);
515
629
  }
516
630
  else {
517
631
  module.debug('Flyout is already visible');
@@ -536,6 +650,7 @@ $.flyout = $.fn.flyout = function(parameters) {
536
650
  if($.isFunction(settings.onHidden)) {
537
651
  settings.onHidden.call(element);
538
652
  }
653
+ module.restore.focus();
539
654
  });
540
655
  settings.onChange.call(element);
541
656
  }
@@ -631,18 +746,25 @@ $.flyout = $.fn.flyout = function(parameters) {
631
746
  module.unbind.clickaway();
632
747
  if(!module.othersActive()) {
633
748
  module.unbind.scrollLock();
749
+ if( settings.keyboardShortcuts ) {
750
+ module.remove.keyboardShortcuts();
751
+ }
634
752
  }
635
753
 
754
+
636
755
  animate = function() {
637
756
  module.set.overlay();
638
757
  module.set.animating();
758
+ if(settings.dimPage && !module.othersVisible()) {
759
+ module.set.closing();
760
+ }
639
761
  module.remove.visible();
640
-
641
762
  };
642
763
  transitionEnd = function(event) {
643
764
  if( event.target == $module[0] ) {
644
765
  $module.off(transitionEvent + elementNamespace, transitionEnd);
645
766
  module.remove.animating();
767
+ module.remove.closing();
646
768
  module.remove.overlay();
647
769
  module.remove.inlineCSS();
648
770
  if(settings.returnScroll) {
@@ -678,6 +800,25 @@ $.flyout = $.fn.flyout = function(parameters) {
678
800
  },
679
801
 
680
802
  set: {
803
+ autofocus: function() {
804
+ var
805
+ $autofocus = $inputs.filter('[autofocus]'),
806
+ $input = ($autofocus.length > 0)
807
+ ? $autofocus.first()
808
+ : ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
809
+ ;
810
+ if($input.length > 0) {
811
+ $input.focus();
812
+ }
813
+ },
814
+ dimmerStyles: function() {
815
+ if(settings.blurring) {
816
+ $pusher.addClass(className.blurring);
817
+ }
818
+ else {
819
+ $pusher.removeClass(className.blurring);
820
+ }
821
+ },
681
822
  bodyMargin: function() {
682
823
  var position = module.can.leftBodyScrollbar() ? 'left':'right';
683
824
  $context.css((isBody ? 'margin-':'padding-')+position, tempBodyMargin + 'px');
@@ -715,6 +856,9 @@ $.flyout = $.fn.flyout = function(parameters) {
715
856
  animating: function() {
716
857
  $module.addClass(className.animating);
717
858
  },
859
+ closing: function() {
860
+ $pusher.addClass(className.closing);
861
+ },
718
862
  direction: function(direction) {
719
863
  direction = direction || module.get.direction();
720
864
  $module.addClass(className[direction]);
@@ -734,6 +878,12 @@ $.flyout = $.fn.flyout = function(parameters) {
734
878
  $style.remove();
735
879
  }
736
880
  },
881
+ keyboardShortcuts: function() {
882
+ module.verbose('Removing keyboard shortcuts');
883
+ $document
884
+ .off('keydown' + eventNamespace)
885
+ ;
886
+ },
737
887
 
738
888
  // ios scroll on html not document
739
889
  ios: function() {
@@ -755,6 +905,9 @@ $.flyout = $.fn.flyout = function(parameters) {
755
905
  animating: function() {
756
906
  $module.removeClass(className.animating);
757
907
  },
908
+ closing: function() {
909
+ $pusher.removeClass(className.closing);
910
+ },
758
911
  direction: function(direction) {
759
912
  direction = direction || module.get.direction();
760
913
  $module.removeClass(className[direction]);
@@ -768,7 +921,6 @@ $.flyout = $.fn.flyout = function(parameters) {
768
921
  },
769
922
 
770
923
  get: {
771
-
772
924
  direction: function() {
773
925
  if($module.hasClass(className.top)) {
774
926
  return className.top;
@@ -798,6 +950,12 @@ $.flyout = $.fn.flyout = function(parameters) {
798
950
  }
799
951
  }
800
952
  },
953
+ id: function() {
954
+ return id;
955
+ },
956
+ element: function() {
957
+ return $module;
958
+ },
801
959
  settings: function() {
802
960
  return settings;
803
961
  }
@@ -813,6 +971,15 @@ $.flyout = $.fn.flyout = function(parameters) {
813
971
  },
814
972
 
815
973
  save: {
974
+ focus: function() {
975
+ var
976
+ $activeElement = $(document.activeElement),
977
+ inCurrentFlyout = $activeElement.closest($module).length > 0
978
+ ;
979
+ if(!inCurrentFlyout) {
980
+ $focusedElement = $(document.activeElement).blur();
981
+ }
982
+ },
816
983
  bodyMargin: function() {
817
984
  initialBodyMargin = $context.css((isBody ? 'margin-':'padding-')+(module.can.leftBodyScrollbar() ? 'left':'right'));
818
985
  var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
@@ -908,6 +1075,11 @@ $.flyout = $.fn.flyout = function(parameters) {
908
1075
  },
909
1076
 
910
1077
  restore: {
1078
+ focus: function() {
1079
+ if($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
1080
+ $focusedElement.focus();
1081
+ }
1082
+ },
911
1083
  bodyMargin: function() {
912
1084
  var position = module.can.leftBodyScrollbar() ? 'left':'right';
913
1085
  $context.css((isBody ? 'margin-':'padding-')+position, initialBodyMargin);
@@ -943,7 +1115,7 @@ $.flyout = $.fn.flyout = function(parameters) {
943
1115
  }
944
1116
  ;
945
1117
  if(shouldEscape.test(string)) {
946
- string = string.replace(/&(?![a-z0-9#]{1,6};)/, "&amp;");
1118
+ string = string.replace(/&(?![a-z0-9#]{1,12};)/gi, "&amp;");
947
1119
  return string.replace(badChars, escapedChar);
948
1120
  }
949
1121
  return string;
@@ -1161,12 +1333,16 @@ $.fn.flyout.settings = {
1161
1333
  context : 'body',
1162
1334
  exclusive : false,
1163
1335
  closable : true,
1336
+ autofocus : true,
1337
+ restoreFocus : true,
1164
1338
  dimPage : true,
1165
1339
  scrollLock : false,
1166
1340
  returnScroll : false,
1167
1341
  delaySetup : false,
1168
1342
  autoShow : false,
1169
1343
 
1344
+ keyboardShortcuts: true,
1345
+
1170
1346
  //dynamic content
1171
1347
  title : '',
1172
1348
  content : '',
@@ -1195,6 +1371,13 @@ $.fn.flyout.settings = {
1195
1371
  onApprove : function(){},
1196
1372
  onDeny : function(){},
1197
1373
 
1374
+ keys : {
1375
+ space : 32,
1376
+ enter : 13,
1377
+ escape : 27,
1378
+ tab : 9,
1379
+ },
1380
+
1198
1381
  className : {
1199
1382
  flyout : 'ui flyout',
1200
1383
  close : 'close icon',
@@ -1203,6 +1386,8 @@ $.fn.flyout.settings = {
1203
1386
  actions : 'actions',
1204
1387
  active : 'active',
1205
1388
  animating : 'animating',
1389
+ blurring : 'blurring',
1390
+ closing : 'closing',
1206
1391
  dimmed : 'dimmed',
1207
1392
  ios : 'ios',
1208
1393
  locked : 'locked',
@@ -1251,7 +1436,8 @@ $.fn.flyout.settings = {
1251
1436
 
1252
1437
  text: {
1253
1438
  ok : 'Ok',
1254
- cancel : 'Cancel'
1439
+ cancel : 'Cancel',
1440
+ close : 'Close'
1255
1441
  }
1256
1442
  };
1257
1443