From 309dfd93c25d23d317470f613d4d8f6a4bea6c6a Mon Sep 17 00:00:00 2001 From: Evgeniy Konstantinov Date: Thu, 30 Jul 2015 15:48:29 +0300 Subject: [PATCH 1/2] radio-group: improve JAWS readability --- common.blocks/radio-group/radio-group.bemhtml | 7 +++++++ common.blocks/radio-group/radio-group.bh.js | 4 ++++ common.blocks/radio/__text/radio__text.bemhtml | 6 ++++++ common.blocks/radio/__text/radio__text.bh.js | 7 +++++++ common.blocks/radio/radio.bemhtml | 5 ++++- common.blocks/radio/radio.bh.js | 5 ++++- common.blocks/radio/radio.deps.js | 2 +- 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 common.blocks/radio/__text/radio__text.bemhtml create mode 100644 common.blocks/radio/__text/radio__text.bh.js diff --git a/common.blocks/radio-group/radio-group.bemhtml b/common.blocks/radio-group/radio-group.bemhtml index 451f2dbfb..760266627 100644 --- a/common.blocks/radio-group/radio-group.bemhtml +++ b/common.blocks/radio-group/radio-group.bemhtml @@ -1,6 +1,13 @@ block('radio-group')( tag()('span'), + attrs()(function() { + return { + role : 'radiogroup', + 'aria-label' : '.' + }; + }), + js()(true), mix()([{ block : 'control-group' }]), diff --git a/common.blocks/radio-group/radio-group.bh.js b/common.blocks/radio-group/radio-group.bh.js index bfc02deb8..9e05ecee5 100644 --- a/common.blocks/radio-group/radio-group.bh.js +++ b/common.blocks/radio-group/radio-group.bh.js @@ -3,6 +3,10 @@ module.exports = function(bh) { bh.match('radio-group', function(ctx, json) { ctx .tag('span') + .attrs({ + role : 'radiogroup', + 'aria-label' : '.' + }) .js(true) .mix({ block : 'control-group' }); diff --git a/common.blocks/radio/__text/radio__text.bemhtml b/common.blocks/radio/__text/radio__text.bemhtml new file mode 100644 index 000000000..5228eae69 --- /dev/null +++ b/common.blocks/radio/__text/radio__text.bemhtml @@ -0,0 +1,6 @@ +block('radio').elem('text')( + tag()('span'), + attrs()(function() { + return { 'aria-hidden' : true }; + }) +); diff --git a/common.blocks/radio/__text/radio__text.bh.js b/common.blocks/radio/__text/radio__text.bh.js new file mode 100644 index 000000000..eaa3609ad --- /dev/null +++ b/common.blocks/radio/__text/radio__text.bh.js @@ -0,0 +1,7 @@ +module.exports = function(bh) { + bh.match('radio__text', function(ctx) { + ctx + .tag('span') + .attr('aria-hidden', true); + }); +}; diff --git a/common.blocks/radio/radio.bemhtml b/common.blocks/radio/radio.bemhtml index 76c875c3f..36c73a9af 100644 --- a/common.blocks/radio/radio.bemhtml +++ b/common.blocks/radio/radio.bemhtml @@ -14,7 +14,10 @@ block('radio')( val : ctx.val } }, - ctx.text + ctx.text && { + elem : 'text', + content : ctx.text + } ]; }) ); diff --git a/common.blocks/radio/radio.bh.js b/common.blocks/radio/radio.bh.js index 04cc34c52..b821fdf87 100644 --- a/common.blocks/radio/radio.bh.js +++ b/common.blocks/radio/radio.bh.js @@ -15,7 +15,10 @@ module.exports = function(bh) { val : json.val } }, - json.text + json.text && { + elem : 'text', + content : json.text + } ]); }); diff --git a/common.blocks/radio/radio.deps.js b/common.blocks/radio/radio.deps.js index 5e179d0ff..f185d6268 100644 --- a/common.blocks/radio/radio.deps.js +++ b/common.blocks/radio/radio.deps.js @@ -2,7 +2,7 @@ mustDeps : { block : 'i-bem', elems : ['dom'] }, shouldDeps : [ { - elems : ['box', 'control'], + elems : ['box', 'control', 'text'], mods : { disabled : true, checked : true, focused : true } }, { block : 'jquery', elem : 'event', mods : { type : 'pointer' } }, From 5bd2f1c8d9ea4d1318f578de007f5b7f979197fe Mon Sep 17 00:00:00 2001 From: Evgeniy Konstantinov Date: Thu, 30 Jul 2015 15:48:50 +0300 Subject: [PATCH 2/2] radio-group: update tmpl-specs --- .../10-no_type_disabled_item.html | 12 +++++++++++- .../20-type_button_disabled_group.html | 11 ++++++++++- .../radio/radio.tmpl-specs/10-checked_disabled.html | 5 ++++- .../radio/radio.tmpl-specs/30-empty.bemjson.js | 3 +++ common.blocks/radio/radio.tmpl-specs/30-empty.html | 3 +++ 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 common.blocks/radio/radio.tmpl-specs/30-empty.bemjson.js create mode 100644 common.blocks/radio/radio.tmpl-specs/30-empty.html diff --git a/common.blocks/radio-group/radio-group.tmpl-specs/10-no_type_disabled_item.html b/common.blocks/radio-group/radio-group.tmpl-specs/10-no_type_disabled_item.html index 1b10d06d2..5fe037dae 100644 --- a/common.blocks/radio-group/radio-group.tmpl-specs/10-no_type_disabled_item.html +++ b/common.blocks/radio-group/radio-group.tmpl-specs/10-no_type_disabled_item.html @@ -1 +1,11 @@ -
+ + +
+ +
diff --git a/common.blocks/radio-group/radio-group.tmpl-specs/20-type_button_disabled_group.html b/common.blocks/radio-group/radio-group.tmpl-specs/20-type_button_disabled_group.html index beaa365cb..03eb4bb23 100644 --- a/common.blocks/radio-group/radio-group.tmpl-specs/20-type_button_disabled_group.html +++ b/common.blocks/radio-group/radio-group.tmpl-specs/20-type_button_disabled_group.html @@ -1 +1,10 @@ - + + + + diff --git a/common.blocks/radio/radio.tmpl-specs/10-checked_disabled.html b/common.blocks/radio/radio.tmpl-specs/10-checked_disabled.html index 8e4d7811b..b1d227d00 100644 --- a/common.blocks/radio/radio.tmpl-specs/10-checked_disabled.html +++ b/common.blocks/radio/radio.tmpl-specs/10-checked_disabled.html @@ -1 +1,4 @@ - + diff --git a/common.blocks/radio/radio.tmpl-specs/30-empty.bemjson.js b/common.blocks/radio/radio.tmpl-specs/30-empty.bemjson.js new file mode 100644 index 000000000..681db287d --- /dev/null +++ b/common.blocks/radio/radio.tmpl-specs/30-empty.bemjson.js @@ -0,0 +1,3 @@ +({ + block : 'radio' +}) diff --git a/common.blocks/radio/radio.tmpl-specs/30-empty.html b/common.blocks/radio/radio.tmpl-specs/30-empty.html new file mode 100644 index 000000000..007f7abe7 --- /dev/null +++ b/common.blocks/radio/radio.tmpl-specs/30-empty.html @@ -0,0 +1,3 @@ +