Skip to content

Commit

Permalink
Merge pull request #2691 from zerline/focus-fix2
Browse files Browse the repository at this point in the history
Focus/blur on a RadioButtons widget.
  • Loading branch information
vidartf authored Jan 8, 2020
2 parents c4775b6 + 729f7ba commit dcaed67
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/controls/src/widget_selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,21 @@ class RadioButtonsView extends DescriptionView {
this.touch();
}

/**
* Handle message sent to the front end.
*/
handle_message(content: any) {
if (content.do == 'focus') {
const firstItem = this.container.firstElementChild as HTMLElement;
firstItem.focus();
} else if (content.do == 'blur') {
for (let i = 0; i < this.container.children.length; i++) {
const item = this.container.children[i] as HTMLElement;
item.blur();
}
}
}

container: HTMLDivElement;
}

Expand Down

0 comments on commit dcaed67

Please sign in to comment.