MDL-71603 editor_atto: Use aria-expanded for show/hide buttons toggle
This commit is contained in:
+3
@@ -80,6 +80,7 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
});
|
||||
|
||||
this._setVisibility(button);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}, this, button);
|
||||
},
|
||||
|
||||
@@ -120,10 +121,12 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
button.set('title', M.util.get_string('showfewer', PLUGINNAME));
|
||||
secondaryRow.show();
|
||||
button.setData(COLLAPSED, false);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
} else {
|
||||
button.set('title', M.util.get_string('showmore', PLUGINNAME));
|
||||
secondaryRow.hide();
|
||||
button.setData(COLLAPSED, true);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-atto_collapse-button",function(s,t){var e="atto_collapse",a="showgroups",o="collapse",l="collapsed",n=".atto_group",h=".atto_toolbar_row";s.namespace("M.atto_collapse").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{initializer:function(){var t,i=s.Object.size(this.get("host").get("plugins"));i<=1+parseInt(this.get(a),10)||this.toolbar.all(n).size()>this.get(a)||(t=this.addButton({icon:"icon",iconComponent:e,callback:this._toggle}),this.get("host").on("pluginsloaded",function(t,i){var o,e=[s.Node.create('<div class="atto_toolbar_row"></div>'),s.Node.create('<div class="atto_toolbar_row" tabindex="-1"></div>')];this.toolbar.appendChild(e[0]).insert(e[1],"after"),(o=this.toolbar.all(n)).slice(0,this.get(a)).each(function(t){e[0].appendChild(t)}),o.slice(this.get(a)).each(function(t){e[1].appendChild(t)}),this._setVisibility(i)},this,t))},_toggle:function(t){t.preventDefault();var i=this.buttons[o];i.getData(l)?(this.highlightButtons(o),this._setVisibility(i,!0),this.toolbar.all(h).item(1).focus()):(this.unHighlightButtons(o),this._setVisibility(i),this.buttons[this.name].focus())},_setVisibility:function(t,i){var o=this.toolbar.all(h).item(1);i?(t.set("title",M.util.get_string("showfewer",e)),o.show(),t.setData(l,!1)):(t.set("title",M.util.get_string("showmore",e)),o.hide(),t.setData(l,!0))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_collapse-button",function(s,t){var o="atto_collapse",a="showgroups",e="collapse",l="collapsed",n=".atto_group",r=".atto_toolbar_row";s.namespace("M.atto_collapse").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{initializer:function(){var t,i=s.Object.size(this.get("host").get("plugins"));i<=1+parseInt(this.get(a),10)||this.toolbar.all(n).size()>this.get(a)||(t=this.addButton({icon:"icon",iconComponent:o,callback:this._toggle}),this.get("host").on("pluginsloaded",function(t,i){var e,o=[s.Node.create('<div class="atto_toolbar_row"></div>'),s.Node.create('<div class="atto_toolbar_row" tabindex="-1"></div>')];this.toolbar.appendChild(o[0]).insert(o[1],"after"),(e=this.toolbar.all(n)).slice(0,this.get(a)).each(function(t){o[0].appendChild(t)}),e.slice(this.get(a)).each(function(t){o[1].appendChild(t)}),this._setVisibility(i),i.setAttribute("aria-expanded","false")},this,t))},_toggle:function(t){t.preventDefault();var i=this.buttons[e];i.getData(l)?(this.highlightButtons(e),this._setVisibility(i,!0),this.toolbar.all(r).item(1).focus()):(this.unHighlightButtons(e),this._setVisibility(i),this.buttons[this.name].focus())},_setVisibility:function(t,i){var e=this.toolbar.all(r).item(1);i?(t.set("title",M.util.get_string("showfewer",o)),e.show(),t.setData(l,!1),t.setAttribute("aria-expanded","true")):(t.set("title",M.util.get_string("showmore",o)),e.hide(),t.setData(l,!0),t.setAttribute("aria-expanded","false"))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
+3
@@ -76,6 +76,7 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
});
|
||||
|
||||
this._setVisibility(button);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}, this, button);
|
||||
},
|
||||
|
||||
@@ -116,10 +117,12 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
button.set('title', M.util.get_string('showfewer', PLUGINNAME));
|
||||
secondaryRow.show();
|
||||
button.setData(COLLAPSED, false);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
} else {
|
||||
button.set('title', M.util.get_string('showmore', PLUGINNAME));
|
||||
secondaryRow.hide();
|
||||
button.setData(COLLAPSED, true);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
});
|
||||
|
||||
this._setVisibility(button);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}, this, button);
|
||||
},
|
||||
|
||||
@@ -118,10 +119,12 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
button.set('title', M.util.get_string('showfewer', PLUGINNAME));
|
||||
secondaryRow.show();
|
||||
button.setData(COLLAPSED, false);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
} else {
|
||||
button.set('title', M.util.get_string('showmore', PLUGINNAME));
|
||||
secondaryRow.hide();
|
||||
button.setData(COLLAPSED, true);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user