Skip to content
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

Content shift when top banner is used #171

Open
3 tasks done
dparker1005 opened this issue Nov 8, 2024 · 0 comments
Open
3 tasks done

Content shift when top banner is used #171

dparker1005 opened this issue Nov 8, 2024 · 0 comments

Comments

@dparker1005
Copy link
Member

dparker1005 commented Nov 8, 2024

Describe the bug
When the top banner is used, it takes a moment to display when pages are loaded. This can cause the page to shift once the banner is shown.

To Reproduce
Steps to reproduce the behavior:

  1. Set up an active sale with a "custom" banner shown at the top of the site. Long "banner text" makes it easier to see this issue.
  2. Visit the frontend of the website and see that the banner does not load immediately.

Cause
Custom Banners are initially set to be hidden here:

<div id="swsales-banner-<?php echo esc_attr( $banner_location_nicename ); ?>" class="swsales-banner" style="display: none;">

And then JS shows the banner here if it hasn’t yet been dismissed:

jQuery('.swsales-banner').show();

This hide/show behavior was added by this commit where the goal was to allow users to dismiss banners either "per page load" or "per session":
92132c9

Expected behavior
Ideally, there would not be a page shift regardless of whether banners are set to dismiss "per page load" or "per session".

With that being said, the easiest solution is to just fix this page shift issue when "per page load" is selected. In this case, the JS to hide/show the banner is not needed, and the banner can always just be displayed immediately.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only the Sitewide Sales and relevant module plugins are active.
  • This bug happens with a default WordPress theme active, or Memberlite.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` Please share non-sensitive information about your hosting environment such as WordPress version, PHP version, Sitewide Sales, and any related plugins versions. ```
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

No branches or pull requests

1 participant