Skip to content

Commit

Permalink
pr comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
marjonlynch committed Apr 22, 2020
1 parent 2eae8e6 commit 4214ba0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from "../styles/recipes";

export const RadioStyles = css`
--var
${display("inline-flex")} :host {
--input-size: calc((${heightNumber} * 0.5) + var(--design-unit));
align-items: center;
Expand Down
9 changes: 4 additions & 5 deletions packages/web-components/fast-components/src/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
keyCodeSpace,
} from "@microsoft/fast-web-utilities";
import { FormAssociated } from "../form-associated";
import { FASTRadio } from ".";
import { FASTRadio } from "./";

const radioGroups = new Map<string, FASTRadio[]>();

Expand Down Expand Up @@ -83,6 +83,7 @@ export class Radio extends FormAssociated<HTMLInputElement> {
this.proxy.checked = this.checked;
}

this.$emit("change");
this.dispatchEvent(new CustomEvent("change", { bubbles: true, composed: true }));
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
this.checkedAttribute = this.checked;
Expand All @@ -93,7 +94,7 @@ export class Radio extends FormAssociated<HTMLInputElement> {
}

private updateOtherGroupRadios(): void {
if (this.name !== undefined && this.parentNode) {
if (this.name !== undefined) {
const radioGroup = radioGroups.get(this.name);
radioGroup?.forEach((radio: FASTRadio) => {
if (radio.getAttribute("value") !== this.value) {
Expand All @@ -117,6 +118,7 @@ export class Radio extends FormAssociated<HTMLInputElement> {
constructor() {
super();
this.proxy.setAttribute("type", "radio");
this.addEventListener("keydown", this.keydownHandler);
}

public connectedCallback(): void {
Expand All @@ -130,8 +132,6 @@ export class Radio extends FormAssociated<HTMLInputElement> {
radioGroups.set(this.name, [this]);
}
}

this.addEventListener("keydown", this.keydownHandler);
}

public disconnectedCallback(): void {
Expand All @@ -145,7 +145,6 @@ export class Radio extends FormAssociated<HTMLInputElement> {
radioGroups.delete(this.name);
}
}
this.removeEventListener("keydown", this.keydownHandler);
}

private updateForm(): void {
Expand Down

0 comments on commit 4214ba0

Please sign in to comment.