Skip to content

Fixed respecting safe area around the ios navigation bar#739

Merged
CodeWithCJ merged 2 commits intoCodeWithCJ:mainfrom
mr-woodapple:fix/ios-bottom-safe-area
Feb 25, 2026
Merged

Fixed respecting safe area around the ios navigation bar#739
CodeWithCJ merged 2 commits intoCodeWithCJ:mainfrom
mr-woodapple:fix/ios-bottom-safe-area

Conversation

@mr-woodapple
Copy link

@mr-woodapple mr-woodapple commented Feb 24, 2026

Currently, if you saved the website as a bookmark to your iOS home screen & enabled the option "Open as Web-App" (or something similar like it, I just translated the German text), the iOS native bottom bar nav indicator (I don't know how to properly call that thing) would be in the way of the Sparky Fitness bottom navigation buttons.

I added a div to respect that bottom bar, see the images below.

Before After

Before (left) and After (right)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mr-woodapple, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a user interface issue on iOS devices where the native bottom bar would overlap with the application's mobile navigation when the website is added to the home screen as a web-app. By integrating safe area handling, the layout now correctly adjusts, providing a seamless and accessible user experience on iOS.

Highlights

  • iOS Safe Area Support: Introduced a CSS class and applied it to the mobile navigation to ensure proper spacing and prevent UI elements from being obscured by the iOS native bottom bar when the application is run as a web-app from the home screen.
Changelog
  • SparkyFitnessFrontend/src/index.css
    • Defined a new CSS class .apple-safe-area that applies padding-bottom using env(safe-area-inset-bottom) to respect iOS safe areas.
  • SparkyFitnessFrontend/src/layouts/MainLayout.tsx
    • Applied the newly created .apple-safe-area class to the mobile navigation <nav> element.
    • Refactored the mobile navigation's internal structure by wrapping the navigation buttons within a new div element to accommodate the safe area padding correctly.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully addresses the iOS safe area issue by introducing the env(safe-area-inset-bottom) CSS property. However, the refactoring of the mobile navigation component introduced a few layout inconsistencies and a potential bug where the grid column count might be incorrectly hardcoded, overriding dynamic behavior. Additionally, a minor stylistic improvement for file formatting is suggested.

</Button>
))}
<nav className="apple-safe-area sm:hidden fixed bottom-0 z-50 w-full bg-background border-t">
<div className={`h-14 grid grid-cols-4 items-center justify-items-center ${mobileGridClass}`}>
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The refactoring of the mobile navigation div introduced a few issues:

  1. Missing gap-1: The gap-1 class, which provided spacing between navigation items, was removed. This might lead to a cramped layout.
  2. Hardcoded grid-cols-4: The grid-cols-4 class is now hardcoded, which will override the dynamic mobileGridClass if the number of available mobile tabs is not exactly four. This can lead to an incorrect grid layout when the tab count varies.
  3. Missing px-2: The horizontal padding (px-2) was removed from the navigation container. This could cause the navigation buttons to touch the screen edges on mobile devices, impacting the user experience.

The suggested change reintroduces the gap-1 and px-2 classes and removes the hardcoded grid-cols-4 to ensure the layout remains dynamic and consistent.

Suggested change
<div className={`h-14 grid grid-cols-4 items-center justify-items-center ${mobileGridClass}`}>
<div className={`h-14 grid gap-1 items-center justify-items-center px-2 ${mobileGridClass}`}>

Copy link
Author

Choose a reason for hiding this comment

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

Not true, because the introduced items-center justify-items-center classes will distribute the available icons across the screen. We'll probably have other issues before that's relevant.

@Sim-sat
Copy link
Contributor

Sim-sat commented Feb 24, 2026

Wouldn't this leave a gap that's too big on other smartphones? On my Android the current gap looks perfect

@mr-woodapple
Copy link
Author

Wouldn't this leave a gap that's too big on other smartphones? On my Android the current gap looks perfect

It shouldn't, no. The way these environement variables work is that they are set by the browser / operating system. So on an Android device, it'll be resolved to 0px (if it is resolved at all).

@Sim-sat
Copy link
Contributor

Sim-sat commented Feb 24, 2026

Okay, learned something new. Looks good👍

@CodeWithCJ
Copy link
Owner

@mr-woodapple Could you clarify the usage. I checked exiting one both on iPhone 13 mini and 15 pro max. I am not sure what does the significance of that space will benefit the bottom bar apart from leaving some space.

I personally like the way it is now as its small and doesn't occupy much space. so we get to see more info from the app.

@mr-woodapple
Copy link
Author

mr-woodapple commented Feb 24, 2026

@CodeWithCJ Sure, when I tap on the most right and left elements in particular, the OS often interprets this as me trying to navigate between apps. Also, I find it annoying that the iOS nav bar handle activates when I tap on elements in the bottom navigation.
Just to be very clear, it's only applicable if the app is saved as a bookmark to the home screen (with the option enabled to open it full-screen, without the browser’s interface).

Not a huge issue, but generally good practice to respect these safe areas. And the space that's "wasted" by respecting these safe areas is negligible (I think ^^).

@CodeWithCJ CodeWithCJ merged commit 0fa9866 into CodeWithCJ:main Feb 25, 2026
5 of 6 checks passed
@CodeWithCJ
Copy link
Owner

CodeWithCJ commented Feb 25, 2026

@mr-woodapple could you run below comments to fix format & lint issues and re-submit the PR

npm run format
npm run lint

@CodeWithCJ
Copy link
Owner

I couldn't re-open it

@mr-woodapple
Copy link
Author

Sure, can do. But running npm run format changes about 380 files, because it changes line endings from CRLF to LF. Is that supposed to be like that? Like I think you should have a .gitattributes file in the repo that solves exactly that. Do you mind if I check one in with my PR? And maybe add the two commands from above to a new workflow that runs these command when a PR towards main is opened/updated?

@Sim-sat
Copy link
Contributor

Sim-sat commented Feb 25, 2026

Yes of course. It's normal to not use windows line endings. We have a prettier config that does exactly that. Feel free to add a .gitatrributes If thats helps. But I thought git does that automatically. I don't have experience in developing with windows though.

I'm not a big fan of adding it to the workflow. The main benefit is that the diffs are smaller. If you add it to the workflow there has to be a new commit for every pr that only changes the format. I added a pre commit hook to the root of the project which you can install with npm Install that run before every commit locally and format it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants