mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-09-22 15:21:58 +00:00
update with AttritubeValue
This commit is contained in:
parent
3cba79d835
commit
31c7907f25
2 changed files with 6 additions and 2 deletions
|
@ -71,7 +71,11 @@ impl NodeDepState for Focus {
|
|||
fn reduce(&mut self, node: NodeView<'_>, _sibling: &Self::DepState, _: &Self::Ctx) -> bool {
|
||||
let new = Focus {
|
||||
level: if let Some(a) = node.attributes().find(|a| a.name == "tabindex") {
|
||||
if let Ok(index) = a.value.parse::<i32>() {
|
||||
if let Some(index) = a
|
||||
.value
|
||||
.as_int32()
|
||||
.or(a.value.as_text().and_then(|v| v.parse::<i32>().ok()))
|
||||
{
|
||||
match index.cmp(&0) {
|
||||
Ordering::Less => FocusLevel::Unfocusable,
|
||||
Ordering::Equal => FocusLevel::Focusable,
|
||||
|
|
|
@ -67,7 +67,7 @@ impl NodeDepState for PreventDefault {
|
|||
let new = match node
|
||||
.attributes()
|
||||
.find(|a| a.name == "dioxus-prevent-default")
|
||||
.map(|a| a.value)
|
||||
.and_then(|a| a.value.as_text())
|
||||
{
|
||||
Some("onfocus") => PreventDefault::Focus,
|
||||
Some("onkeypress") => PreventDefault::KeyPress,
|
||||
|
|
Loading…
Reference in a new issue