Skip to content

Commit

Permalink
fix(buttons): add role="group" to radio group
Browse files Browse the repository at this point in the history
Closes #1503
  • Loading branch information
troy authored and pkozlowski-opensource committed Apr 19, 2017
1 parent 47bbb46 commit c847a92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/buttons/radio.spec.ts
Expand Up @@ -577,6 +577,15 @@ describe('ngbRadioGroup', () => {

expect(() => { fixture.debugElement.query(By.css('Input')).triggerEventHandler('focus', {}); }).not.toThrow();
});

describe('accessibility', () => {
it('should have "group" role', () => {
const fixture = TestBed.createComponent(TestComponent);
fixture.detectChanges();

expect(getGroupElement(fixture.nativeElement).getAttribute('role')).toBe('group');
});
});
});

@Component({selector: 'test-cmp', template: ''})
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/radio.ts
Expand Up @@ -13,7 +13,7 @@ const NGB_RADIO_VALUE_ACCESSOR = {
*/
@Directive({
selector: '[ngbRadioGroup]',
host: {'data-toggle': 'buttons', 'class': 'btn-group'},
host: {'data-toggle': 'buttons', 'class': 'btn-group', 'role': 'group'},
providers: [NGB_RADIO_VALUE_ACCESSOR]
})
export class NgbRadioGroup implements ControlValueAccessor {
Expand Down

0 comments on commit c847a92

Please sign in to comment.