8000 Enhance main navbar to improve bouncing on macOS by tagliala · Pull Request #8727 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content

Enhance main navbar to improve bouncing on macOS #8727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tagliala
Copy link
Contributor
@tagliala tagliala commented May 21, 2025

As specified in the Flowbite documentation, the sticky navbar should
utilize the fixed class instead of the sticky class.

This was causing a poor bouncing effect on macOS on all browser except
Safari.

This commit:

  • Replaces the sticky class with the fixed class, to improve
    bouncing effect
  • Adds a top padding to the main body element, to take into
    consideration the space used by the fixed navbar

NOTE: Flowbite documentation suggests to use the aside tag instead
for the sidebar, but this breaks the see-through effect, so div is
being preserved

Close #8726

Ref:

@tagliala
Copy link
Contributor Author

@vfonic can't tell if this will be merged, but if you want to take a look to this branch

Copy link
codecov bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.11%. Comparing base (e874086) to head (02e27ba).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8727   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files         141      141           
  Lines        4074     4074           
=======================================
  Hits         4038     4038           
  Misses         36       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -6,7 +6,7 @@
</head>
<body class="bg-white dark:bg-gray-950/95 text-gray-950 dark:text-gray-100 antialiased">
<%= render "active_admin/site_header", title: site_title %>
<div class="xl:ms-60">
<div class="xl:ms-60 pt-16">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used pt-16 instead of mt-16 because of Flowbite's documentation, copilot suggestion, and tailwind's website:

image

@vfonic
Copy link
Contributor
vfonic commented May 21, 2025

Wow, that was fast! Works great on both Chrome and Safari. Thanks @tagliala! 🚀

@tagliala tagliala requested a review from javierjulio June 1, 2025 08:38
Copy link
Member
@javierjulio javierjulio left a comment

Choose a reason for hiding this comment

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

This breaks the see-through effect. If it's causing issues elsewhere not worth the hassle. Also I do remember copying that style from Tailwind which as you shared from their source they don't use sticky anymore. They did at one point as I confirmed through Web Archive.

Copy link
Member

Choose a reason for hiding this comment

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

We should avoid making this element change. No need to modify or match what Flowbite is doing in this case and rather not make a change here unless necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just wanted to point out that Chrome and other Chromium-based browsers (like Edge, Brave, Arc) make up around 60-70% of desktop browser market share. Since this issue appears in those browsers (I tested on Brave as well), it could affect a large portion of end users.
Safari holds about 15-20% of desktop browser market share.

Since this is an open-source project, prioritizing the fixes that benefit the majority of end-users and developers might be the best approach.

Maybe there's a way to have this fixed so that the see-through effect isn't lost on Safari? I'll see if I can find some win-win solution.

Copy link
Contributor
@vfonic vfonic Jun 1, 2025

Choose a reason for hiding this comment

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

I just tested this in the latest stable versions of Brave and Safari (Version 18.5 (20621.2.5.11.8)).

To me both, AAv4 beta15 and these changes work the same in Safari: The main page content goes under the translucent header on scroll down. Is this what you mean by "see-through effect"?

Screenshot

Screenshot 2025-06-01 at 16 31 04

In Brave, these changes fix the issue I reported in #8726

Here's the before (AAv4 beta15) screen recording (Safari then Brave):

Screen.Recording.2025-06-01.at.16.24.49.mov

Here's the screen recording after applying this PR's changes (Safari then Brave):

Screen.Recording.2025-06-01.at.16.22.09.mov

NOTE: All the emails in these screenshots/videos are from FFaker gem.

Copy link
Member

Choose a reason for hiding this comment

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

@vfonic I'm not sure why you commented on this thread. It's not related to my comment. I was only requesting to remove the div->aside change as it's unnecessary. Everything else would remain. That may be a source for confusion as to why this was closed.

@tagliala
Copy link
Contributor Author
tagliala commented Jun 5, 2025

Got it. This is a minor issue, I'm going to close here for the moment

@javierjulio
Copy link
Member

@tagliala sorry, I think there is confusion coming from my review comment. That was a request to only remove the div->aside change which is unnecessary. Everything else would remain.

@tagliala
Copy link
Contributor Author
tagliala commented Jun 6, 2025

Ah sorry, will fix

@tagliala tagliala force-pushed the bugfix/8726-fix-navbar branch from af9c938 to 1f33a5d Compare June 6, 2025 12:14
As specified in the Flowbite documentation, the sticky navbar should
utilize the `fixed` class instead of the `sticky` class.

This was causing a poor bouncing effect on macOS on all browser except
Safari.

This commit:
- Replaces the `sticky` class with the `fixed` class, to improve
  bouncing effect
- Adds a top padding to the main body element, to take into
  consideration the space used by the fixed navbar

NOTE: Flowbite documentation suggests to use the `aside` tag instead
for the sidebar, but this breaks the see-through effect, so `div` is
being preserved

Close #8726

Ref:
- https://flowbite.com/docs/components/sidebar/#sidebar-with-navbar
@tagliala tagliala force-pushed the bugfix/8726-fix-navbar branch from 1f33a5d to 02e27ba Compare June 6, 2025 12:15
@tagliala
Copy link
Contributor Author
tagliala commented Jun 6, 2025

Rebased and fixed. I've added to the commit message why div is preferred over aside

@vfonic
Copy link
Contributor
vfonic commented Jun 6, 2025

@javierjulio Sorry, my bad. Something feels slightly different about the GitHub UI. Or maybe I simply didn't see that your comment only related to the div => aside change...

A375

@tagliala
Copy link
Contributor Author
tagliala commented Jun 6, 2025

@javierjulio Sorry, my bad. Something feels slightly different about the GitHub UI. Or maybe I simply didn't see that your comment only related to the div => aside change...

didn't see that either, but now I've double checked the see-through effect and it looks it's working as before

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.

v4: Sidebar + navbar scroll looks off on macOS
3 participants
0