xooie 0.1.4 → 0.1.5

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NWYyZTlkZGQyZDgyZjlhZGE1ODNlMWFjZjliNWU4YzljZDhhNzFlMg==
5
- data.tar.gz: !binary |-
6
- ZmRjMTBlZDI1OTE1YzBmMjE0N2Q4YmNjM2ZmNDliMmM1NzIyYjg4ZQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- Y2Y4MTgxZmQwZDRmMzcyZWYyM2JmZmUyMmNiNDg4N2M4NWY3YzM0MzAzOTdl
10
- MmNmNzVkNTMwZTNlZjA1ZjkwNDk4MWVmNWIyMmQ5NzA1Nzc1YmQxMDE1NGU2
11
- ZGViNzExZjg0NGViZjJiOTBkYTdiZjVmOWYxMGMzZmJiYmZlOWY=
12
- data.tar.gz: !binary |-
13
- NDJiMDgyY2U2YWVhNmEwNDk5N2RiYjEwNTU4N2VhOGZmNzIwNjA3Mzc3OWYx
14
- ODY2ZDBlNDgwZTI4NDQ3ZGZhMjkyMjdmZjNkNzUyMjljMWZkZWY4YjRiNGI3
15
- ZmQ0NjAxMWY2ODFlN2NiZTUzY2E5Y2E0ZWU3NzhjZGVjNmIxZWY=
2
+ SHA1:
3
+ metadata.gz: bba9ef5b7fd47812ebd8bcf300e546a972f6e6d3
4
+ data.tar.gz: 6ff0ba21b6c701a1d749169faa5c33283c727da8
5
+ SHA512:
6
+ metadata.gz: 0bb54e98a604cac3f43d8771837ce9b1f746ae53b113d9328dd6bbc361768b3493d0bf9eea5cd9ee48f5f0dc631f7b40fe150d8c66ac01c63279fa5cf8b3e928
7
+ data.tar.gz: d828d26641b76aba41f47a11c8ff04a02f797cd45d44fc4595a4a2ea82c0675eeef181d291ab0e52a6e2c42171f249f5d11eda76ce35ace1b53894490b12d65f
@@ -17,16 +17,22 @@
17
17
  define('xooie/dialog', ['jquery', 'xooie/base'], function($, Base) {
18
18
 
19
19
  var Dialog = Base('dialog', function(){
20
- var self = this;
20
+ var self = this,
21
+ contentId;
21
22
 
22
23
  this.id = Dialog._counter++;
23
24
 
25
+ contentId = 'modal-content-' + this.id;
26
+
24
27
  Dialog._instances[this.id] = this;
25
28
 
26
29
  this.root.attr('data-dialog-id', this.id);
27
30
 
31
+ this.root.find(this.options.contentSelector).attr('id', contentId);
32
+
28
33
  //add accessibility attributes
29
- this.root.find(this.options.containerSelector).attr('role', 'dialog');
34
+ this.root.find(this.options.containerSelector).attr('role', 'dialog')
35
+ .attr('aria-describedby', contentId);
30
36
 
31
37
  this.root.addClass('xooie-dialog');
32
38
 
@@ -46,6 +52,7 @@ define('xooie/dialog', ['jquery', 'xooie/base'], function($, Base) {
46
52
  Dialog.setDefaultOptions({
47
53
  closeButtonSelector: '[data-role="closeButton"]',
48
54
  containerSelector: '[data-role="container"]',
55
+ contentSelector: '[data-role="content"]',
49
56
 
50
57
  dialogActiveClass: 'is-dialog-active'
51
58
  });
@@ -76,6 +83,8 @@ define('xooie/dialog', ['jquery', 'xooie/base'], function($, Base) {
76
83
 
77
84
  Dialog._active = this;
78
85
 
86
+ this.getTabbable().first().focus();
87
+
79
88
  this.root.trigger('dialogActive');
80
89
  };
81
90
 
@@ -94,6 +103,26 @@ define('xooie/dialog', ['jquery', 'xooie/base'], function($, Base) {
94
103
  this.root.trigger('dialogInactive');
95
104
  };
96
105
 
106
+ // Loosely based on jQueryUI's tabbable selector logic
107
+ Dialog.prototype.getTabbable = function () {
108
+ return this.root.find(this.options.containerSelector).find('*').filter(function (i) {
109
+ var tag, tabindex, istabbable;
110
+
111
+ tag = this.nodeName.toLowerCase();
112
+ tabindex = parseInt($(this).attr('tabindex'), 10);
113
+
114
+ if (/input|select|textarea|button|object/.test(tag)) {
115
+ istabbable = !this.disabled && (isNaN(tabindex) || tabindex > -1);
116
+ } else if ('a' === tag || 'area' === tag) {
117
+ istabbable = this.href || tabindex > -1;
118
+ } else {
119
+ istabbable = tabindex > -1;
120
+ }
121
+
122
+ return istabbable && !$(this)['area' === tag ? 'parents' : 'closest'](':hidden').length;
123
+ });
124
+ };
125
+
97
126
  Dialog._instances = [];
98
127
  Dialog._counter = 0;
99
128
  Dialog._active = null;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xooie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Larkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,6 +30,9 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - License.txt
34
+ - README.md
35
+ - lib/xooie.rb
33
36
  - vendor/assets/javascripts/xooie.js
34
37
  - vendor/assets/javascripts/xooie/addons/base.js
35
38
  - vendor/assets/javascripts/xooie/addons/carousel_lentils.js
@@ -43,9 +46,6 @@ files:
43
46
  - vendor/assets/javascripts/xooie/dropdown.js
44
47
  - vendor/assets/javascripts/xooie/stylesheet.js
45
48
  - vendor/assets/javascripts/xooie/tab.js
46
- - lib/xooie.rb
47
- - README.md
48
- - License.txt
49
49
  homepage: http://github.com/Comcast/Xooie
50
50
  licenses:
51
51
  - Apache
@@ -56,18 +56,19 @@ require_paths:
56
56
  - lib
57
57
  required_ruby_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - ! '>='
64
+ - - '>='
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
68
  rubyforge_project:
69
- rubygems_version: 2.0.3
69
+ rubygems_version: 2.2.2
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: A highly modular, extensible JavaScript UI framework.
73
73
  test_files: []
74
+ has_rdoc: