diff options
author | Josh Matthews <josh@joshmatthews.net> | 2020-06-12 18:19:49 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2020-06-15 11:22:28 -0400 |
commit | d55424e88f732c663d1ec988a3fbe98d6c9a89e5 (patch) | |
tree | df7a560a43747431fd49ef897b682d987fe4082c /components/script/dom/document.rs | |
parent | 757371f4f08aca089659fa6774e74bb90b511363 (diff) | |
download | servo-d55424e88f732c663d1ec988a3fbe98d6c9a89e5.tar.gz servo-d55424e88f732c663d1ec988a3fbe98d6c9a89e5.zip |
Update document focus when element focusability changes.
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 97ca60af115..385f7c2139e 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1025,6 +1025,17 @@ impl Document { *self.focus_transaction.borrow_mut() = FocusTransaction::InTransaction(Default::default()); } + /// <https://html.spec.whatwg.org/multipage/#focus-fixup-rule> + pub(crate) fn perform_focus_fixup_rule(&self, not_focusable: &Element) { + if Some(not_focusable) != self.focused.get().as_ref().map(|e| &**e) { + return; + } + self.request_focus( + self.GetBody().as_ref().map(|e| &*e.upcast()), + FocusType::Element, + ) + } + /// Request that the given element receive focus once the current transaction is complete. /// If None is passed, then whatever element is currently focused will no longer be focused /// once the transaction is complete. |