Repository navigation
Keep pagers, lists and scroll views right beside a side bar on iOS, and add header-beside - #217
Open
cmcmanus96 wants to merge 4 commits into
Open
cmcmanus96 wants to merge 4 commits into
cmcmanus96 wants to merge 4 commits into
Conversation
Beside a vertical bar (the iPhone Duo's side rail, or a notched iPhone held sideways) the pager's ScrollView draws into the bar's inset, so the next page showed under the bar. Its visibleRect takes in that inset too, so a page measured against it was wider than the step .paging takes. The reported page and the tab underline fell further behind on each later page. A horizontal pager now measures a page by the ScrollView's own width, which is what .paging steps by, and clips its sides. A scrollable tab row clips its sides the same way. Pages still run under a bar at the bottom, and vertical pagers are unchanged.
When iOS resizes the pager, it can come back between two pages. That happens when iOS resizes the app in the background, or when the Duo folds or unfolds while the app is in front. PagerResume keeps the page the user chose, a tab tap or a page PHP jumped to, and scrolls back to it once the size settles. It tries twice, then gives up, accepts the nearest page and reports it to PHP. One geometry sample now drives the page, the tab progress and the report, so they can't disagree mid resize.
header-beside="expanded" (any breakpoint name, or a width in points) moves a horizontal pager's header into a leading column of its own once the window is that wide. The tabs and pages fill the trailing column. On a foldable the columns split at the fold. When the fold is partly closed they stop at the edges of its division region, so no control sits in the crease. Elsewhere the two columns share the width evenly. Narrower than the breakpoint, the header stays above the tabs, in each page's list, as before. Native decides from the live window width, as it does for responsive classes, so PHP sends the header once and unfolding or Split View moves it without a round trip. Both layouts share one paging scroll view, so crossing the breakpoint keeps the page and every page's scroll offset. iOS only for now. Android keeps the header above the tabs at any width.
Beside a vertical bar (the iPhone Duo's side rail, or a notched iPhone held sideways) a list stopped at the bar's inset. Its scroll indicator floated in from the screen edge, and row backgrounds ended short of the bar. Apple's own lists run under the bar. Lists, virtual lists, scroll views and a pager's beside-header column now ignore the horizontal container safe area and hand that inset back to their content as safe area. Rows stay where they were, their backgrounds reach under the bar, and the indicator sits at the screen edge. A horizontal pager does the same at its sides. Each page now spans the side insets as well as the bottom one, so .paging still steps by one page, and the pager measures its page width with the side insets included. On a screen with no side inset, such as a portrait iPhone, nothing changes.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
On iOS, a window can have a vertical bar at its side: the iPhone Duo's rail, or the notch on an iPhone held sideways. A horizontal pager beside one goes wrong:
visibleRect, which includes the bar's inset, while.pagingsteps by the scroll view's own width. The tab underline falls further behind on each later tab, and a reported page can be the wrong one.Lists and scroll views stop short of the bar. Their scroll indicator floats in from the screen edge, and row backgrounds end before the bar. Apple's own lists run under it.
Fix
Four commits, best read one at a time:
geometry.bounds.widthand clips its sides, and so does a scrollable tab row. Pages still run under a bar at the bottom. Vertical pagers are unchanged.PagerResumekeeps the page the user chose (a tab tap, or a page PHP jumped to) and scrolls back to it once the size settles. It tries twice, then accepts the nearest page and reports it. One geometry sample drives the page, the tab progress and the report, so they can't disagree mid-resize.header-beside="expanded"(any breakpoint name, or a width in points) moves a horizontal pager's header into its own leading column once the window is that wide. On a foldable the columns split at the fold, and a half-open fold keeps every control out of the crease. iOS decides from the live window width, so unfolding moves the header without a round trip to PHP. Android keeps the header above the tabs for now..pagingstill steps by exactly one page when the bar moves sides.main)Closed iPhone Duo, rail on the left. On
main, Trending is selected but the underline sits short of it, and the previous page's text shows under the rail. With this PR, the underline is under Trending and nothing shows under the rail.Why one PR
I first split this into four PRs, but the middle states are worse than
main. With only commits 1 and 2, rotating a closed Duo once moved the pager off Trending to between pages.maindoesn't do that, and the whole set doesn't either:mainUnfolding from Trending, 8 times on each build: all four commits held the page exactly every time, and so did commits 1 and 2. Commit 1 alone left a 1 pt sliver of the previous page on 2 of 8.
Commits 1 and 2 alone, after one rotation round trip: the pager is between pages and Latest is selected.
header-beside="expanded"on the unfolded Duo: the profile header in the leading column, the tabs and pages in the trailing one.For review
PagerPosition,PagerResumeandPagerResizehold its state.header-besideis new, opt-in API, iOS only for now.Test plan
headerBeside()(breakpoint names, a width in points, an unknown name throws), and lists running under a side bar. 507 pass. Pint is clean.headerBeside()parsing, which Android ignores.