NO BUG: Page Scroll When Closing Off Canvas Menu

Browser: Chrome Version 138.0.7204.169 (Official Build) (arm64)
OS: macOS
URL: https://britannia.edynam.com/
Video: Jam

Hi Bricks Team!

Not sure if this one constitutes as a bug but I found an issue when using the Off Canvas element. When closing the off-canvas, the page scrolls up a bit each time. This is particularly prevalent on Chrome, but I also noticed a small amount of scrolling on Safari as well (the issue is non-existent on Firefox).

To recreate:

  1. Create an off-canvas and include a button to close it. (I suspect the issue may have to do with the sticky header, so you may need to set up the off-canvas in the header and enable “Sticky header” and “Sticky on scroll” settings.)
  2. Open the page in Chrome
  3. Scroll down slightly and open the off-canvas
  4. Close the off-canvas

After a very small amount of digging, I found it may have to do with a line in the bricksOffcanvas() function inside of bricks.min.js.


Removing this line seemed to stop the issue from occurring.

Please let me know if there’s anything I can do about this.

Thanks in advance!

Hi @josh_mitch,

I can see the issue on your website, but I can’t replicate it locally. Can you please export the template so that I can try with the same structure?

Thank you,
Matej

Hi Matej, thanks for looking into it for me.

Here’s a link to the JSON file for the header template - Bricks Forum – Google Drive

Hi @josh_mitch,

thank you. I found the issue. The issue goes away as soon as I remove the scroll-padding-top from CSS. I believe this is coming from your custom styles, right?

Please try to remove it and let me know if it solves the issue.
Matej

Hi @Matej that worked but I still need the scroll padding for my anchor links because of my sticky header…is there any other way around this?

Nevermind I managed to solve it by putting a scroll-margin-top on the element that I’m scrolling to and that worked :slight_smile:

Hi @josh_mitch,

great to hear that you solved it. :slight_smile: I’ll mark it as no-bug, as it’s not directly related to Bricks.

Best regards,
Matej

1 Like