- commit
- 2446de1005281698d40848f7eeb6f15aeae42fbe
- parent
- 137aee0f416f98840dd08b9ef1fef7160a9aead7
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-02-14 14:44
update accdc and aria-api@0.2.2
Diffstat
| M | babel.js | 89 | +++++++++++++++++++++++++++++++++++++------------------------ |
| M | package.json | 2 | +- |
2 files changed, 55 insertions, 36 deletions
diff --git a/babel.js b/babel.js
@@ -4776,11 +4776,13 @@ exports.extraSelectors = {
4776 4776 cell: ['td'],
4777 4777 checkbox: ['input[type="checkbox"]'],
4778 4778 combobox: [
-1 4779 'input:not([type])[list]',
4779 4780 'input[type="email"][list]',
4780 4781 'input[type="search"][list]',
4781 4782 'input[type="tel"][list]',
4782 4783 'input[type="text"][list]',
4783 4784 'input[type="url"][list]',
-1 4785 'select:not([multiple])',
4784 4786 ],
4785 4787 complementary: ['aside'],
4786 4788 definition: ['dd'],
@@ -4793,6 +4795,7 @@ exports.extraSelectors = {
4793 4795 img: ['img:not([alt=""])'],
4794 4796 link: ['a[href]', 'area[href]', 'link[href]'],
4795 4797 list: ['dl', 'ol', 'ul'],
-1 4798 listbox: ['select[multiple]'],
4796 4799 listitem: ['dt', 'ul > li', 'ol > li'],
4797 4800 main: ['main'],
4798 4801 math: ['math'],
@@ -4814,6 +4817,7 @@ exports.extraSelectors = {
4814 4817 status: ['output'],
4815 4818 table: ['table'],
4816 4819 textbox: [
-1 4820 'input:not([type]):not([list])',
4817 4821 'input[type="email"]:not([list])',
4818 4822 'input[type="tel"]:not([list])',
4819 4823 'input[type="text"]:not([list])',
@@ -5010,6 +5014,7 @@ exports.labelable = [
5010 5014 },{}],9:[function(require,module,exports){
5011 5015 var constants = require('./constants.js');
5012 5016 var query = require('./query.js');
-1 5017 var util = require('./util.js');
5013 5018
5014 5019 var getPseudoContent = function(node, selector) {
5015 5020 var styles = window.getComputedStyle(node, selector);
@@ -5030,7 +5035,13 @@ var getContent = function(root, referenced) {
5030 5035 if (node.nodeType === node.TEXT_NODE) {
5031 5036 ret += node.textContent;
5032 5037 } else if (node.nodeType === node.ELEMENT_NODE) {
5033 -1 ret += getName(node, true, referenced);
-1 5038 if (node.tagName.toLowerCase() === 'br') {
-1 5039 ret += '\n';
-1 5040 } else if (window.getComputedStyle(node).display.substr(0, 6) === 'inline') {
-1 5041 ret += getName(node, true, referenced);
-1 5042 } else {
-1 5043 ret += ' ' + getName(node, true, referenced) + ' ';
-1 5044 }
5034 5045 }
5035 5046 node = node.nextSibling;
5036 5047 }
@@ -5049,22 +5060,21 @@ var isLabelable = function(el) {
5049 5060 };
5050 5061
5051 5062 // Control.labels is part of the standard, but not supported in most browsers
5052 -1 var getLabelNode = function(node) {
5053 -1 if (node.id) {
5054 -1 var selector = 'label[for="' + node.id + '"]';
5055 -1 var label = document.querySelector(selector);
5056 -1 if (label) {
5057 -1 return label;
5058 -1 }
5059 -1 }
5060 -1
5061 -1 var p = node.parentElement;
5062 -1 while (p) {
5063 -1 if (p.tagName.toLowerCase() === 'label') {
5064 -1 return p;
-1 5063 var getLabelNodes = function(element) {
-1 5064 var labels = [];
-1 5065 var labelable = constants.labelable.join(',');
-1 5066 util.walkDOM(document.body, function(node) {
-1 5067 if (node.tagName && node.tagName.toLowerCase() === 'label') {
-1 5068 if (node.getAttribute('for')) {
-1 5069 if (element.id && node.getAttribute('for') === element.id) {
-1 5070 labels.push(node);
-1 5071 }
-1 5072 } else if (node.querySelector(labelable) === element) {
-1 5073 labels.push(node);
-1 5074 }
5065 5075 }
5066 -1 p = p.parentElement;
5067 -1 }
-1 5076 });
-1 5077 return labels;
5068 5078 };
5069 5079
5070 5080 // http://www.ssbbartgroup.com/blog/how-the-w3c-text-alternative-computation-works/
@@ -5090,32 +5100,37 @@ var getName = function(el, recursive, referenced) {
5090 5100 ret = el.getAttribute('aria-label');
5091 5101 }
5092 5102 if (!query.matches(el, 'presentation')) {
5093 -1 if (!ret && isLabelable(el)) {
5094 -1 var label = getLabelNode(el);
5095 -1 if (!recursive && label) {
5096 -1 ret = getName(label, true, label);
5097 -1 }
-1 5103 if (!ret && !recursive && isLabelable(el)) {
-1 5104 var strings = getLabelNodes(el).map(function(label) {
-1 5105 return getName(label, true, label);
-1 5106 });
-1 5107 ret = strings.join(' ');
5098 5108 }
5099 5109 if (!ret) {
5100 5110 ret = el.getAttribute('placeholder');
5101 5111 }
5102 -1 // figcaption
5103 5112 if (!ret) {
5104 5113 ret = el.getAttribute('alt');
5105 5114 }
-1 5115 if (!ret && el.matches('abbr,acronym') && el.title) {
-1 5116 ret = el.title;
-1 5117 }
-1 5118 // figcaption
5106 5119 // caption
5107 5120 // table
5108 5121 }
5109 5122 // FIXME only if this is embedded in a label
5110 -1 if (!ret && query.matches(el, 'input')) {
5111 -1 // combobox
5112 -1 // button
5113 -1 if (query.matches(el, 'range')) {
5114 -1 ret = query.getAttribute(el, 'valuetext') || query.getAttribute(el, 'valuenow') || el.value;
5115 -1 } else {
5116 -1 ret = el.value;
-1 5123 if (!ret && query.matches(el, 'textbox,button,combobox,range')) {
-1 5124 if (query.matches(el, 'textbox,button')) {
-1 5125 ret = el.value || el.textContent;
-1 5126 } else if (query.matches(el, 'combobox')) {
-1 5127 var selected = query.querySelector(el, ':selected') || query.querySelector(el, 'option');
-1 5128 if (selected) {
-1 5129 ret = getName(selected, recursive, referenced);
-1 5130 }
-1 5131 } else if (query.matches(el, 'range')) {
-1 5132 ret = '' + (query.getAttribute(el, 'valuetext') || query.getAttribute(el, 'valuenow') || el.value);
5117 5133 }
5118 -1 ret = '' + ret;
5119 5134 }
5120 5135 if (!ret && (recursive || allowNameFromContent(el))) {
5121 5136 ret = getContent(el, referenced);
@@ -5124,7 +5139,7 @@ var getName = function(el, recursive, referenced) {
5124 5139 ret = el.getAttribute('title');
5125 5140 }
5126 5141
5127 -1 return (ret || '').trim().replace(/\s+/g, ' ');
-1 5142 return ret || '';
5128 5143 };
5129 5144
5130 5145 var getDescription = function(el) {
@@ -5147,11 +5162,13 @@ var getDescription = function(el) {
5147 5162 };
5148 5163
5149 5164 module.exports = {
5150 -1 getName: getName,
-1 5165 getName: function(el) {
-1 5166 return getName(el).replace(/\s+/g, ' ').trim();
-1 5167 },
5151 5168 getDescription: getDescription,
5152 5169 };
5153 5170
5154 -1 },{"./constants.js":8,"./query.js":10}],10:[function(require,module,exports){
-1 5171 },{"./constants.js":8,"./query.js":10,"./util.js":11}],10:[function(require,module,exports){
5155 5172 var constants = require('./constants.js');
5156 5173 var util = require('./util.js');
5157 5174
@@ -14190,7 +14207,7 @@ module.exports = {
14190 14207 })(typeof window === 'object' ? window : this);
14191 14208 },{}],13:[function(require,module,exports){
14192 14209 /*!
14193 -1 CalcNames 1.3, compute the Name and Description property values for a DOM node
-1 14210 CalcNames 1.4, compute the Name and Description property values for a DOM node
14194 14211 Returns an object with 'name' and 'desc' properties.
14195 14212 Functionality mirrors the steps within the W3C Accessible Name and Description computation algorithm.
14196 14213 http://www.w3.org/TR/accname-aam-1.1/
@@ -14560,8 +14577,10 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14560 14577 /*
14561 14578 HTML5 Block Elements indexed from:
14562 14579 https://github.com/webmodules/block-elements
-1 14580 Note: 'br' was added to this array because it impacts visual display and should thus add a space .
-1 14581 Reference issue: https://github.com/w3c/accname/issues/4
14563 14582 */
14564 -1 var blockElements = ['address', 'article', 'aside', 'blockquote', 'canvas', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video'];
-1 14583 var blockElements = ['address', 'article', 'aside', 'blockquote', 'br', 'canvas', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video'];
14565 14584
14566 14585 var isHidden = function(node, refNode) {
14567 14586 if (node.nodeType !== 1 || node == refNode) {
diff --git a/package.json b/package.json
@@ -4,7 +4,7 @@ 4 4 "description": "compare different implementations of accname", 5 5 "devDependencies": { 6 6 "accessibility-developer-tools": "^2.12.0",7 -1 "aria-api": "^0.2.1",-1 7 "aria-api": "^0.2.2", 8 8 "axe-core": "^2.6.1", 9 9 "w3c-alternative-text-computation": "github:accdc/w3c-alternative-text-computation" 10 10 },