Update modal demo to focus input on open. (#147)
This commit is contained in:
parent
a36e3e09d5
commit
6d86e64846
2 changed files with 5 additions and 0 deletions
|
|
@ -254,6 +254,8 @@ impl ModalStory {
|
|||
|
||||
let overlay = self.modal_overlay;
|
||||
cx.open_drawer(move |this, cx| {
|
||||
input.focus_handle(cx).focus(cx);
|
||||
|
||||
this.margin_top(px(33.))
|
||||
.placement(placement)
|
||||
.overlay(overlay)
|
||||
|
|
@ -305,6 +307,8 @@ impl ModalStory {
|
|||
let view = cx.view().clone();
|
||||
|
||||
cx.open_modal(move |modal, cx| {
|
||||
input1.focus_handle(cx).focus(cx);
|
||||
|
||||
modal
|
||||
.title("Form Modal")
|
||||
.overlay(overlay)
|
||||
|
|
|
|||
|
|
@ -299,6 +299,7 @@ impl TextInput {
|
|||
self.disabled
|
||||
}
|
||||
|
||||
/// Focus the input field.
|
||||
pub fn focus(&self, cx: &mut ViewContext<Self>) {
|
||||
self.focus_handle.focus(cx);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue