Make clicking on an element request focus for focusable elements.

This commit is contained in:
Josh Matthews 2020-06-12 17:35:58 -04:00
parent a34d1573b6
commit 757371f4f0
5 changed files with 46 additions and 24 deletions

View file

@ -23,7 +23,7 @@ use crate::dom::htmlfieldsetelement::HTMLFieldSetElement;
use crate::dom::htmlformelement::{FormControl, HTMLFormElement};
use crate::dom::htmlinputelement::HTMLInputElement;
use crate::dom::keyboardevent::KeyboardEvent;
use crate::dom::node::{document_from_node, window_from_node};
use crate::dom::node::window_from_node;
use crate::dom::node::{
BindContext, ChildrenMutation, CloneChildrenFlag, Node, NodeDamage, UnbindContext,
};
@ -606,8 +606,6 @@ impl VirtualMethods for HTMLTextAreaElement {
if event.type_() == atom!("click") && !event.DefaultPrevented() {
//TODO: set the editing position for text inputs
document_from_node(self).request_focus(self.upcast());
} else if event.type_() == atom!("keydown") && !event.DefaultPrevented() {
if let Some(kevent) = event.downcast::<KeyboardEvent>() {
// This can't be inlined, as holding on to textinput.borrow_mut()