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

Fix for RouteFocusChanged and focusable descendants #925

Merged
merged 5 commits into from
May 14, 2020

Conversation

yrns
Copy link
Contributor

@yrns yrns commented May 13, 2020

My project uses a hierarchy of focusable widgets and I ran into some problems which I've attempted to fix here.

  • Route RouteFocusChanged all the way down since a focusable widget
    may contain descendants which can also have focus

  • Instead of replacing RouteFocusChanged with FocusChanged, send it
    after the former is completely routed, so request_focus is cleared

  • Added a new test case to demonstrate cases that would previously
    fail, along with some test harness fixes/additions

yrns added 2 commits May 13, 2020 10:47
* Route RouteFocusChanged all the way down since a focusable widget
may contain descendants which can also have focus

* Instead of replacing RouteFocusChanged with FocusChanged, send it
after the former is completely routed, so request_focus is cleared

* Added a new test case to demonstrate cases that would previously
fail, along with some test harness fixes/additions
@xStrom
Copy link
Member

xStrom commented May 13, 2020

I'll take a look at this more closely later, but for now I just have one quick comment.

  • Route RouteFocusChanged all the way down since a focusable widget
    may contain descendants which can also have focus

This does not sound correct to me. Only a single widget has focus.

@xStrom xStrom added the S-needs-review waits for review label May 13, 2020
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Okay so now that I've looked more closely I can see that there was a bug with shared ancestors. I think this solution is generally fine, but I have a few inline comments.

druid/src/tests/mod.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
druid/src/core.rs Outdated Show resolved Hide resolved
@xStrom xStrom added S-waiting-on-author waits for changes from the submitter and removed S-needs-review waits for review labels May 14, 2020
@yrns
Copy link
Contributor Author

yrns commented May 14, 2020

I think I addressed everything, and fixed the conflict.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks for doing this!

@xStrom xStrom removed the S-waiting-on-author waits for changes from the submitter label May 14, 2020
@xStrom xStrom merged commit e637e53 into linebender:master May 14, 2020
@yrns yrns deleted the focus branch May 14, 2020 23:42
@yrns
Copy link
Contributor Author

yrns commented May 14, 2020

Thank you for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants