-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bindings for
FocusOptions
(#3996)
- Loading branch information
1 parent
9beb4c3
commit 71bd366
Showing
7 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#![allow(unused_imports)] | ||
#![allow(clippy::all)] | ||
use super::*; | ||
use wasm_bindgen::prelude::*; | ||
#[wasm_bindgen] | ||
extern "C" { | ||
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = FocusOptions)] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
#[doc = "The `FocusOptions` dictionary."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] | ||
pub type FocusOptions; | ||
#[wasm_bindgen(method, setter = "focusVisible")] | ||
fn focus_visible_shim(this: &FocusOptions, val: bool); | ||
#[wasm_bindgen(method, setter = "preventScroll")] | ||
fn prevent_scroll_shim(this: &FocusOptions, val: bool); | ||
} | ||
impl FocusOptions { | ||
#[doc = "Construct a new `FocusOptions`."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] | ||
pub fn new() -> Self { | ||
#[allow(unused_mut)] | ||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); | ||
ret | ||
} | ||
#[doc = "Change the `focusVisible` field of this object."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] | ||
pub fn focus_visible(&mut self, val: bool) -> &mut Self { | ||
self.focus_visible_shim(val); | ||
self | ||
} | ||
#[doc = "Change the `preventScroll` field of this object."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] | ||
pub fn prevent_scroll(&mut self, val: bool) -> &mut Self { | ||
self.prevent_scroll_shim(val); | ||
self | ||
} | ||
} | ||
impl Default for FocusOptions { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* The origin of this IDL file is: | ||
* https://html.spec.whatwg.org/multipage/interaction.html#focusoptions | ||
*/ | ||
|
||
dictionary FocusOptions { | ||
boolean preventScroll = false; | ||
boolean focusVisible; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters