Skip to content

Commit

Permalink
code: Unset tabIndex upon assigning -1
Browse files Browse the repository at this point in the history
The value of -1 for tabIndex always means that it's unset,
even in AVM1 where tabIndex may have a value of `undefined`.
  • Loading branch information
kjarosh authored and Dinnerbone committed Apr 30, 2024
1 parent 054d0aa commit f40cb64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/display_object/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,12 @@ pub trait TInteractiveObject<'gc>:
}

fn set_tab_index(&self, context: &mut UpdateContext<'_, 'gc>, value: Option<i32>) {
// tabIndex = -1 is always equivalent to unset tabIndex
let value = if matches!(value, Some(-1)) {
None
} else {
value
};
self.raw_interactive_mut(context.gc()).tab_index = value
}
}
Expand Down

0 comments on commit f40cb64

Please sign in to comment.