Skip to content
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: Allow pressing buttons with keyboard #16281

Merged
merged 7 commits into from
May 10, 2024

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented May 10, 2024

Related to #5443.

This PR allows the keyboard to be used (Enter/Space) to press buttons.

As always, there are some tests and some related refactors and fixes, described in commit messages.

@kjarosh kjarosh force-pushed the keyboard-button-press branch 2 times, most recently from efa5e5e to 6bdfc72 Compare May 10, 2024 16:47
kjarosh added 7 commits May 10, 2024 22:30
Some button events (e.g. KeyUp/KeyDown) seem to require a state when
the highlight is not visible, but is active (i.e. a focus is selected).
That is why this patch introduces a third possible state of
the highlight: ActiveHidden.
Since highlight has 3 states now, it's better represented by
describing the state instead of having a checkbox.
A re-focus button has been added to compensate for the fact
that the highlight cannot be automatically enabled anymore.
This condition is identical for buttons and movie clips.
It seems that button event handlers not only require focus to be fired,
but also an active highlight.
This patch allows the keyboard to be used (Enter/Space) to press buttons.
This test verifies the behavior of pressing buttons with a keyboard.
This test ensures that button key press events take precedence
over pressing focused buttons with keyboard.
@Dinnerbone Dinnerbone force-pushed the keyboard-button-press branch from 6bdfc72 to 54fa583 Compare May 10, 2024 20:30
@Dinnerbone Dinnerbone enabled auto-merge (rebase) May 10, 2024 20:31
@Dinnerbone Dinnerbone merged commit b4cbac6 into ruffle-rs:master May 10, 2024
17 checks passed
@kjarosh kjarosh deleted the keyboard-button-press branch May 10, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants