无线电输入上的Angular 2 keydowns触发(点击)事件

时间:2018-06-14 02:16:38

标签: javascript angular javascript-events angular2-forms angular2-directives

我有一个单选按钮组,我绑定了一个单击事件处理程序。我现在正在为键盘用户进行辅助功能测试,并发现每个箭头键按下都会触发(单击)处理程序并记录为MouseEvent。我无法理解为什么会出现这种情况并填充我的功能,因为这意味着用户基本上只能选择第一个选项。

有人能说清楚这个吗?

<div class="flex-container neg-margins hidden-sm hidden-xs">
     <div class="flex-child col-md-3 col-sm-4 col-xs-6"

                             *ngFor="let option of question.subCats">          
                            <!--<label [for]="option.id">{{option.label}}</label>-->
                            <input class="choice-input" 
                                   type="radio" 
                                   [name]="question.id" 
                                   [id]="option.id" 
                                   (keyup.space)="onKey($event, question)"
                                   (click)="onKey($event)"
                                   [attr.aria-labelledby]="option.id"
                            >
                            <div class="c-label-holder" 
                                 [ngStyle]="{'border-top': highlightColor(option.bdrColor)}" 
                                 [ngClass]="{'selectedCat': option?.isSelected}"
                            >

                            </div>
                        </div>
                    </div>

0 个答案:

没有答案