Skip to content

CC-110: --footer-bar-height CSS Variable Incorrect#31

Merged
ianpaschal merged 1 commit into
masterfrom
ian/cc-110--footer-bar-height-css-variable-incorrect
Jun 13, 2026
Merged

CC-110: --footer-bar-height CSS Variable Incorrect#31
ianpaschal merged 1 commit into
masterfrom
ian/cc-110--footer-bar-height-css-variable-incorrect

Conversation

@ianpaschal

@ianpaschal ianpaschal commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Resolves CC-110

Summary by CodeRabbit

  • Style
    • Improved footer bar layout and spacing calculations for better mobile device compatibility
    • Enhanced footer bar height measurement accuracy

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR refactors the FooterBar component's sizing and layout mechanisms. The height measurement was updated to use the ResizeObserver's border-box dimensions instead of content-rect, and the default reserved height in the theme CSS was reset from 4rem to 0. The SCSS layout was reorganized: footer-bar padding-bottom was simplified, footer-bar-content margin and padding logic was adjusted to handle borders and safe-area insets in a consolidated way, and the mobile variant's padding calculation was refactored to use an explicit horizontal padding variable.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly references the specific issue (CC-110) and identifies the exact problem being fixed: the incorrect --footer-bar-height CSS variable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ian/cc-110--footer-bar-height-css-variable-incorrect

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Stylelint (17.12.0)
src/style/variables.scss

ConfigurationError: Could not find "stylelint-config-clean-order". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:285:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:252:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:85:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:138:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:127:22)

src/components/FooterBar/FooterBar.module.scss

ConfigurationError: Could not find "stylelint-config-clean-order". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:285:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:252:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:85:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:138:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:127:22)

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed due to a network error.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/FooterBar/FooterBar.tsx`:
- Around line 37-38: The FooterBar currently sets a global CSS var
'--footer-bar-height' in the ResizeObserver callback (in the FooterBar
component) but unconditionally clears it on cleanup; change this to track
ownership so the variable is only removed when the last FooterBar unmounts: add
a module-level counter (e.g., footerBarInstanceCount) that you increment when
the component mounts and decrement in the cleanup, set the CSS variable when the
observer reports a height (same code: entry.borderBoxSize?.[0]?.blockSize ??
entry.target.getBoundingClientRect().height) and only remove/reset
'--footer-bar-height' in the cleanup when footerBarInstanceCount reaches zero;
ensure all references are done inside the FooterBar component's effect/observer
lifecycle so other instances retain the variable while active.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e8869b7d-a77b-4793-b728-fc2888305909

📥 Commits

Reviewing files that changed from the base of the PR and between 1b8e7c4 and 955e126.

📒 Files selected for processing (3)
  • src/components/FooterBar/FooterBar.module.scss
  • src/components/FooterBar/FooterBar.tsx
  • src/style/variables.scss

Comment on lines +37 to +38
const height = entry.borderBoxSize?.[0]?.blockSize ?? entry.target.getBoundingClientRect().height;
document.documentElement.style.setProperty('--footer-bar-height', `${height}px`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Prevent shared --footer-bar-height from being cleared by the wrong instance.

This component writes a global CSS variable, but cleanup removes it unconditionally. With the default now 0, unmounting one FooterBar can collapse layout even if another FooterBar is still mounted. Track ownership (or active instance count) before removing the variable.

Suggested fix (instance-count guard)
+let activeFooterBars = 0;
+
 export const FooterBar = ({
   children,
   className,
   maxWidth = '100vw',
   mobile = false,
   portalTarget = document.body,
 }: FooterBarProps): ReactElement => {
   const contentRef = useRef<HTMLDivElement>(null);

   useEffect(() => {
+    activeFooterBars += 1;
     const content = contentRef.current;
     if (!content) {
       return;
     }
     const observer = new ResizeObserver(([entry]) => {
       const height = entry.borderBoxSize?.[0]?.blockSize ?? entry.target.getBoundingClientRect().height;
       document.documentElement.style.setProperty('--footer-bar-height', `${height}px`);
     });
     observer.observe(content);
     return () => {
       observer.disconnect();
-      document.documentElement.style.removeProperty('--footer-bar-height');
+      activeFooterBars -= 1;
+      if (activeFooterBars === 0) {
+        document.documentElement.style.removeProperty('--footer-bar-height');
+      }
     };
   }, []);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/FooterBar/FooterBar.tsx` around lines 37 - 38, The FooterBar
currently sets a global CSS var '--footer-bar-height' in the ResizeObserver
callback (in the FooterBar component) but unconditionally clears it on cleanup;
change this to track ownership so the variable is only removed when the last
FooterBar unmounts: add a module-level counter (e.g., footerBarInstanceCount)
that you increment when the component mounts and decrement in the cleanup, set
the CSS variable when the observer reports a height (same code:
entry.borderBoxSize?.[0]?.blockSize ??
entry.target.getBoundingClientRect().height) and only remove/reset
'--footer-bar-height' in the cleanup when footerBarInstanceCount reaches zero;
ensure all references are done inside the FooterBar component's effect/observer
lifecycle so other instances retain the variable while active.

@ianpaschal ianpaschal merged commit f4a53d0 into master Jun 13, 2026
2 checks passed
@ianpaschal ianpaschal deleted the ian/cc-110--footer-bar-height-css-variable-incorrect branch June 13, 2026 17:33
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.

1 participant