Skip to content

fix(content): fullscreen offset is computed correctly with tab bar - #28245

Merged
liamdebeasi merged 3 commits into
mainfrom
FW-5245
Oct 4, 2023
Merged

fix(content): fullscreen offset is computed correctly with tab bar#28245
liamdebeasi merged 3 commits into
mainfrom
FW-5245

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Sep 27, 2023

Copy link
Copy Markdown
Contributor

Issue number: resolves #21130


What is the current behavior?

IonContent sets --offset-top and --offset-bottom variables to allow the content to scroll under headers, footers, and tab bars. This is essential to creating the translucency effect on these components.

IonContent does this by computing its offsetHeight and offsetTop coordinates which take into account the dimensions of headers, footers, and tab bars. Occasionally, this code will run before the IonTabBar has been hydrated which means that the offset will be wrong because the IonTabBar will have a dimension of 0x0 prior to hydration.

This impacts Ionic Angular devs who are using the lazy loaded build of Ionic. React and Vue devs are not impacted because they are using the dist-custom-elements build of Ionic which does not have hydration.

What is the new behavior?

  • IonContent will re-run the offset computation code whenever the ionTabBarLoaded event is emitted. This event is emitted at most once per IonTabBar instance.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 7.4.2-dev.11695831341.191bdf12

Note: I did not write a test since this is fixing a race condition. I wasn't able to find a non-flaky way of testing this. You can test this in an Ionic Angular Tabs starter application with the dev build. The --offset-bottom variable on ion-content should be large enough such that the content will scroll under the tab bar. The translucency effect won't work just yet, but that is being fixed in #28246.

@github-actions github-actions Bot added the package: core @ionic/core package label Sep 27, 2023
this.onScrollEnd();
}

@Listen('appload', { target: 'window' })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

appload does not always run after all components have been hydrated, so this listener wasn't actually helping at all.

@liamdebeasi liamdebeasi changed the title Fw 5245 @liamdebeasi fix(content): fullscreen offset is computed correctly with tab bar Sep 27, 2023
@liamdebeasi liamdebeasi changed the title @liamdebeasi fix(content): fullscreen offset is computed correctly with tab bar fix(content): fullscreen offset is computed correctly with tab bar Sep 27, 2023
@liamdebeasi
liamdebeasi marked this pull request as ready for review September 27, 2023 16:50
@liamdebeasi
liamdebeasi requested review from a team, brandyscarney and sean-perkins and removed request for a team September 27, 2023 16:50
@liamdebeasi
liamdebeasi added this pull request to the merge queue Oct 4, 2023
Merged via the queue into main with commit 7375dd6 Oct 4, 2023
@liamdebeasi
liamdebeasi deleted the FW-5245 branch October 4, 2023 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Platform MD ion-content wrong --offset-bottom

2 participants