fix(appbar): prevent large/medium header title from being clipped on iOS#4941
Draft
azizbecha wants to merge 1 commit into
Draft
fix(appbar): prevent large/medium header title from being clipped on iOS#4941azizbecha wants to merge 1 commit into
azizbecha wants to merge 1 commit into
Conversation
In `medium`/`large` mode the inner column was sized to its content rather than to the Appbar's fixed `modeAppbarHeight`, so the controls row plus the title's padding/line-height could exceed the header height. On iOS, where `Surface` renders a fixed-size layer, the overflowing title got clipped. Add `alignSelf: 'stretch'` to `columnContainer` so it fills the header height; the controls row and `AppbarContent` (`justifyContent: 'flex-end'`) then partition that known height and the title stays within bounds.
|
Hey @azizbecha, thank you for your pull request 🤗. The documentation from this branch can be viewed here. |
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.
Summary
Appbar.Headerwithmode="large"(andmode="medium") renders its title clipped on iOS — the lower portion of the title text is cut off, and it sits too high in the header instead of being bottom-aligned. Android is unaffected.Root cause
In
medium/largemode,Appbarrenders acolumnContainer(flexDirection: 'column',flex: 1) holding acontrolsRowstacked overAppbarContent. The Appbar's content row usesalignItems: 'center', socolumnContaineris not stretched to the Appbar's fixedmodeAppbarHeight(large= 152,medium= 112) — it's sized to its content. The controls row plusAppbarContent's mode padding (v3LargeContainer:paddingTop: 36+paddingBottom: 28;v3MediumContainer:paddingBottom: 24) plus the headline line-height can exceed the header height, so the title overflows the Appbar's bounds. On iOS, whereSurfacerenders a fixed-size layer (SurfaceIOS), that overflow is clipped; on Android it's a single view, so it spills instead of clipping (less visible).Fix
Add
alignSelf: 'stretch'tostyles.columnContainerso the column fills the header's fixed height inmedium/largemode. The controls row andAppbarContent(justifyContent: 'flex-end') then partition a known height and the title stays within bounds.columnContainer: { flexDirection: 'column', flex: 1, + alignSelf: 'stretch', paddingTop: 8, },Testing
yarn jest src/components/__tests__/Appbar— 37 passed, 2 snapshots passed (no snapshot churn)yarn eslint src/components/Appbar/Appbar.tsx— cleansmall/medium/large/center-aligned; confirm the title is fully visible and bottom-aligned in medium/large, and there's no Android regression). IfalignSelf: 'stretch'alone isn't sufficient, follow-ups would be givingcontrolsRowa fixed height instead offlex: 1, and/or rebalancing thev3MediumContainer/v3LargeContainerpaddings inAppbarContent.tsx.