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

avm1: Drop focus on EditText when something else is clicked #16587

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Jun 4, 2024

In AVM1 text fields are somewhat special when handling focus. When a text field is clicked, it gains focus, when something else is clicked, it loses the focus. However, this logic only applies to text fields, other objects (buttons, movie clips) neither gain focus nor lose it upon press.

This behavior might have appeared inconsistent, as some SWFs lose focus on EditText when something else is clicked, some don't. Turns out that difference results from mx.managers.FocusManager. It automatically focuses the last focused EditText after click, so that it seemed that the field did not lose the focus. In reality it lost the focus on press, and gained it again on release. Since mx.managers.FocusManager now works (#5443), Ruffle will mirror this behavior when this PR is merged.

@kjarosh kjarosh force-pushed the avm1-focus-mouse branch 3 times, most recently from 944ab6a to 4f899f9 Compare June 4, 2024 09:07
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Jun 4, 2024
@danielhjacobs danielhjacobs added the A-avm1 Area: AVM1 (ActionScript 1 & 2) label Jun 4, 2024
Copy link
Contributor

@Dinnerbone Dinnerbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

kjarosh added 2 commits June 4, 2024 19:08
In AVM1 text fields are somewhat special when handling focus.
When a text field is clicked, it gains focus,
when something else is clicked, it loses the focus.
However, this logic only applies to text fields, other objects
(buttons, movie clips) neither gain focus nor lose it upon press.
This test verifies how FP handles focus changes on mouse clicks.
@Dinnerbone Dinnerbone merged commit cc70686 into ruffle-rs:master Jun 4, 2024
17 checks passed
@danielhjacobs danielhjacobs removed the waiting-on-review Waiting on review from a Ruffle team member label Jun 4, 2024
@kjarosh kjarosh deleted the avm1-focus-mouse branch June 4, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2)
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants