Skip to content

Commit 2b704bb

Browse files
committed
fix(radio): radio buttons not being a tab stop and missing focus indication
* Fixes the radio buttons not being tabable. * Adds focus indication to the radio buttons. Referencing #421.
1 parent dfc580d commit 2b704bb

File tree

3 files changed

+20
-73
lines changed

3 files changed

+20
-73
lines changed

scripts/browserstack/start_tunnel.sh

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/lib/radio/radio.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!-- TODO(jelbourn): render the radio on either side of the content -->
22
<!-- TODO(mtlin): Evaluate trade-offs of using native radio vs. cost of additional bindings. -->
3-
<label [attr.for]="inputId" class="md-radio-label">
3+
<!-- TODO(crisbeto): only show focus indication if focus came from a keyboard event -->
4+
<label [attr.for]="inputId" class="md-radio-label" [class.md-ripple-focused]="_isFocused">
45
<!-- The actual 'radio' part of the control. -->
56
<div class="md-radio-container">
67
<div class="md-radio-outer-circle"></div>

src/lib/radio/radio.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,24 @@ describe('MdRadio', () => {
574574
expect(document.activeElement).toBe(fruitRadioNativeInputs[i]);
575575
}
576576
});
577+
578+
it('should add a ripple when the native input element is focused', () => {
579+
let hostElement = seasonRadioInstances[0].getHostElement() as HTMLElement;
580+
let input = hostElement.querySelector('input') as HTMLInputElement;
581+
let label = hostElement.querySelector('label') as HTMLLabelElement;
582+
583+
expect(label.classList).not.toContain('md-ripple-focused');
584+
585+
dispatchEvent('focus', input);
586+
fixture.detectChanges();
587+
588+
expect(label.classList).toContain('md-ripple-focused');
589+
590+
dispatchEvent('blur', input);
591+
fixture.detectChanges();
592+
593+
expect(label.classList).not.toContain('md-ripple-focused');
594+
});
577595
});
578596
});
579597

0 commit comments

Comments
 (0)