【发布时间】:2019-01-08 02:49:10
【问题描述】:
我正在尝试做一些事情,我认为使用 EXT.js 4 应该相对简单,但我找不到答案。我正在尝试创建一个当前类型为“复选框”的复选框,当我尝试将其呈现为 type="button"
这是我正在做的一个示例(我相信这段代码来自 Sencha 本身,但这是我想要做的)
此代码
Ext.create('Ext.form.Panel', {
bodyPadding: 10,
width : 300,
title : 'Pizza Order',
items: [{
xtype : 'fieldcontainer',
fieldLabel : 'Toppings',
defaultType: 'checkboxfield',
items: [{
boxLabel : 'Anchovies',
name : 'topping',
inputValue: '1',
id : 'checkbox1'
}, {
boxLabel : 'Artichoke Hearts',
name : 'topping',
inputValue: '2',
checked : true,
id : 'checkbox2'
}, {
boxLabel : 'Bacon',
name : 'topping',
inputValue: '3'
id : 'checkbox3'
}]
}],
bbar: [{
text: 'Select Bacon',
handler: function() {
var checkbox = Ext.getCmp('checkbox3');
checkbox.setValue(true);
}
},
'-',
{
text: 'Select All',
handler: function() {
var checkbox1 = Ext.getCmp('checkbox1'),
checkbox2 = Ext.getCmp('checkbox2'),
checkbox3 = Ext.getCmp('checkbox3');
checkbox1.setValue(true);
checkbox2.setValue(true);
checkbox3.setValue(true);
}
},{
text: 'Deselect All',
handler: function() {
var checkbox1 = Ext.getCmp('checkbox1'),
checkbox2 = Ext.getCmp('checkbox2'),
checkbox3 = Ext.getCmp('checkbox3');
checkbox1.setValue(false);
checkbox2.setValue(false);
checkbox3.setValue(false);
}
}],
renderTo: Ext.getBody()
});
渲染
<input type="button" hidefocus="true" autocomplete="off" class="x-form-field x-form-checkbox x-form-cb" id="checkbox1-inputEl" aria-invalid="false" data-errorqtip="">
注意到 type="button" 了吗?我需要类型是“复选框”
让我包括原因,也许我正在接近这个错误。我试图让 JAWS 阅读器以应有的方式阅读复选框。作为“按钮”类型,JAWS 阅读器像按钮一样阅读它,而不是阅读复选框附带的 标签。
希望如此,请提出您需要的任何问题并感谢您的帮助。
罗斯
【问题讨论】:
-
您使用的是什么版本的 ExtJS? 4.1? 4.2?
-
这段代码有什么问题我可以看到这里面的正常行为。你能指定更多细节吗?
-
这里的问题是 需要一个属性 role="checkbox" 才能被 JAWS 正确显示。
-
我正在使用 4.1.... 看起来像添加 role="checkbox" 作品。我现在正在环顾四周,如何添加它,但如果有人不能指出我正确的方向,我将不胜感激。谢谢!
标签: javascript extjs checkbox jaws-screen-reader