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

Improve FocusBehavior: support list view lazy render. support control x:load #4099

Merged
merged 5 commits into from
Jul 21, 2021

Conversation

lyf6lyf
Copy link
Contributor

@lyf6lyf lyf6lyf commented Jul 7, 2021

Fixes

PR Type

What kind of change does this PR introduce?

Bugfix
Feature

What is the current behavior?

The App will crash (throws an NullPointerException) if we put a control whose x:Load = False into FocusBehavior list.
The App won't focus on a ListView items when they are deferred rendering.

What is the new behavior?

The App won't crash in above case.
The deferred item will get focus when it is loaded.
The ListView will get focus when its item is rendered.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

@ghost
Copy link

ghost commented Jul 7, 2021

Thanks lyf6lyf for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker and azchohfi July 7, 2021 06:46
@net-foundation-cla
Copy link

net-foundation-cla bot commented Jul 7, 2021

CLA assistant check
All CLA requirements met.

@net-foundation-cla
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ lyf6lyf sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

@ghost ghost requested a review from Rosuavio July 7, 2021 06:46
@michael-hawker michael-hawker added this to the 7.1 milestone Jul 7, 2021
@michael-hawker michael-hawker added bug 🐛 An unexpected issue that highlights incorrect behavior helpers ✋ improvements ✨ labels Jul 7, 2021
@michael-hawker michael-hawker added the next preview ✈️ Label for marking what we want to include in the next preview release for developers to try. label Jul 15, 2021
Copy link
Contributor

@Rosuavio Rosuavio left a comment

Choose a reason for hiding this comment

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

Just a small comment, but otherwise it looks good.

// The list may not have any item yet, we wait until the first item is rendered.
listViewBase.ContainerContentChanging -= OnContainerContentChanging;
listViewBase.ContainerContentChanging += OnContainerContentChanging;
listViewBaseControls++;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like a flag should be fine instead of counter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've push the fix in the new commit.

@ghost
Copy link

ghost commented Jul 21, 2021

This PR has been marked as "needs attention 👋" and awaiting a response from the team.

@ghost
Copy link

ghost commented Jul 21, 2021

Hello @michael-hawker!

Because this pull request has the auto merge :zap: label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@michael-hawker michael-hawker merged commit a920345 into CommunityToolkit:main Jul 21, 2021
@XAML-Knight
Copy link
Contributor

Bug fix confirmed.

Unfortunately, though, I was unable to get the (populated) ListView to receive focus, with these changes.

@lyf6lyf
Copy link
Contributor Author

lyf6lyf commented Jul 23, 2021

Bug fix confirmed.

Unfortunately, though, I was unable to get the (populated) ListView to receive focus, with these changes.

@XAML-Knight It works fine on my side. could you try to increase the timeout?

@XAML-Knight
Copy link
Contributor

Hi @lyf6lyf , I tried increasing the timeout, but still couldn't get the ListView (or any item in the ListView) to capture focus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merge ⚡ bug 🐛 An unexpected issue that highlights incorrect behavior helpers ✋ improvements ✨ needs attention 👋 next preview ✈️ Label for marking what we want to include in the next preview release for developers to try. priority 🚩
Projects
No open projects
Bugs 7.1
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

5 participants