Fix banner overlay caused by !important padding-top in host app#35
Merged
saturnflyer merged 1 commit intomainfrom Feb 10, 2026
Merged
Fix banner overlay caused by !important padding-top in host app#35saturnflyer merged 1 commit intomainfrom
saturnflyer merged 1 commit intomainfrom
Conversation
When the newshound gem was added to an application that had an !important rule on body padding-top, the banner padding was overridden, causing the banner to overlay page content instead of pushing it down. The banner JS now detects !important rules on body padding-top from other stylesheets and mirrors that priority on the newshound rule. Padding is managed via the CSSOM (setProperty) on the existing stylesheet rule instead of inline styles, so both approaches no longer conflict. The style element has an ID for direct access, and the rule reference and priority detection are cached to avoid redundant queries on resize and toggle. Fixed: Banner overlaying content in apps with !important body padding-top rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
!importantonbody { padding-top }, the banner padding was overridden, causing the banner to overlay page content instead of pushing it down!importantrules from other stylesheets and mirrors that priority on the newshound rule via CSSOMsetPropertyidon the style element) instead of inline styles, eliminating the conflict between the two approachesTest plan
!importanton bodypadding-topand verify the banner pushes content down!importantpadding rules still work correctly