Fix Sticky ScrollHeader causing unwanted scrolling with Popups on ListItems #3568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3415
I took a quick look at the ScrollHeader bug and it was simple enough so:
The Scrollheader's
StickyHeaderBehavior
adjusts scrolling when focusing an element of the ScrollViewer if it's slightly hidden by the header. This imitates standard ScrollViewer behavior.However,
ScrollViewer.GotFocus
also triggers if we open a Flyout on a ListItem, but since the scrolling calculation didn't plan for that, it ends up scrolling the list by the height of the Flyout.An easy fix for this is to check if the focused element is really part of the list and not just a popup, which can be done by checking if the element has a parent or not.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
If a Popup/Flyout of any kind is assigned to either the ListView or its items, opening it by right-click will scroll the ListView by the height of the Flyout if a Sticky ScrollHeader is used.
The bug can be easily repro'd in the sample app's ScrollHeader page by adding a Flyout to its ListView:
What is the new behavior?
Showing the Flyout no longer scrolls the ListView.
PR Checklist
Please check if your PR fulfills the following requirements:
Other information