选中复选框时,Aria 选中的值不会从 true 切换为 false

Aria-checked value not switching from true to false when checking the checkbox

我的屏幕 reader JAWS 17 正在读取 Checkbox not checked 当我在复选框上时,即使我选中了它。

我调试了这个问题,发现 aria-checked="false" 没有切换到 aria-checked="true"当我检查的时候。

我正在使用 Google Chrome 58.0.3029.110(64 位)

HTML

<modified-input
         enter-space-press="checked(row)"
         disabled="!row.enabled"
         ng-click="check(row)">
 </modified-input>

指令

function modifiedInput($window, $rootScope, _) {
        return {
            restrict: 'E',
            scope: {
                value:'=?',
                disabled:'=?',
            },
            template: (
                '<input ' +
                'type="checkbox" ' +
                'ng-disabled="disabled" ' +
                'aria-checked= "false" ' +
                'ng-value="value"/>'
            ),

        };
    }

    modifiedInput.$inject = ["$window", "$rootScope", '_'];
    module.exports = modifiedInput;

在您的项目中使用 ngAria。它应该自动处理常见的 aria 属性。

阅读official documentation here.

working plunker here.

根据文档,如果您在项目中包含 ngAria 并使用 ng-model,则会自动处理 aria 属性。

我建议将模板更改为:

    template: (
        '<input ' +
        'type="checkbox" ' +
        'ng-disabled="disabled" ' +
        'ng-value="value" ' +
        'ng-model="checked"/>'
    )