-
-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: Add basic support for Tab key behavior #15542
Conversation
.. | ||
} | ||
) { | ||
// Prevent egui from consuming the Tab key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On #13426, it was stated that
The TAB key is used to access the inventory in the game, but in the Ruffle desktop player, TAB moves through Ruffle's own menus and doesn't forward the key to the game. Fortunately, you can also open the inventory by clicking the backpack with the mouse...
Does this change fix that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true, it should be fixed now.
a38d008
to
1ac611b
Compare
2249ad3
to
87bd3c3
Compare
5a85439
to
6b1768c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, assuming the nits are fixed and that weird behavior I found on discord is documented (maybe a failing test?)
@@ -46,6 +46,7 @@ pub struct Avm1ButtonData<'gc> { | |||
object: Lock<Option<Object<'gc>>>, | |||
initialized: Cell<bool>, | |||
has_focus: Cell<bool>, | |||
tab_index: Cell<Option<i32>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you document all these places, that they might eventually need to be moved to InteractiveObject?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, added a TODO for each one
core/src/display_object.rs
Outdated
/// Used to customize tab ordering. | ||
/// When not `None`, a custom ordering is used, and | ||
/// objects are ordered according to this value. | ||
fn get_tab_index(&self) -> Option<i64> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: as a general convention, getter-like functions don't have the get_
prefix in their name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, removed the prefix from all getters
self.0.read().tab_index | ||
} | ||
|
||
pub fn set_tab_index_value(&self, context: &mut UpdateContext<'_, 'gc>, value: Option<i32>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, just tab_index
and set_tab_index
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the prefix, but left the _value
suffix due to the i32/u32 thingy and a potential name conflict with tab_index
41853fc
to
bec2ad4
Compare
Added a test |
The Tab key is used to cycle through focusable elements in stage. It supports two tab orderings: automatic and custom. This patch adds basic support for this behavior.
This test checks the basic support of tab ordering and its automatic mode.
This test checks the basic support of tab ordering and its custom mode.
This test verifies the behavior of properties related to tab ordering.
This test covers the edge case of MovieClip.tabIndex, where setting it to a string at the start returns this string instead of a numerical value.
Related to #5443. Improves coverage for AVM1: #243, #263, #280.
The Tab key is used to cycle through focusable elements in stage. It supports two tab orderings: automatic and custom. This patch adds basic support for this behavior and both modes.
Things implemented:
TextField.tabEnabled
in AVM1.TextField.tabIndex
in AVM1.Button.tabEnabled
in AVM1.Button.tabIndex
in AVM1.MovieClip.tabEnabled
in AVM1.MovieClip.tabIndex
in AVM1.Things known to be missing/broken yet:
MovieClip.tabChildren
in AVM1 is not implemented.