Skip to content

Fix floating buttons covering content on mobile/tablet#23373

Merged
mohini-crl merged 4 commits into
mainfrom
fix/mobile-responsive-floating-buttons
May 27, 2026
Merged

Fix floating buttons covering content on mobile/tablet#23373
mohini-crl merged 4 commits into
mainfrom
fix/mobile-responsive-floating-buttons

Conversation

@mohini-crl
Copy link
Copy Markdown
Contributor

Summary

  • "Rate This Page" button: Hidden on mobile/tablet (< 992px) and moved into the Docs Menu sidebar. Clicking it closes the sidebar and opens the feedback overlay full-width from the bottom of the screen.
  • "Ask AI" (Kapa) button: Shrunk to a 36x36px icon-only button on mobile/tablet so it no longer overlaps page content. Modal z-index bumped to 9999 for proper layering.
  • Both features remain fully accessible on all screen sizes — just repositioned/resized to avoid covering content.

Related issue

EDUENG-104

Files changed

File Change
src/current/_includes/feedback-widget.html Added media query to hide floating button on mobile; feedback overlay renders full-width
src/current/_includes/head.html Shrink Kapa button to icon-only on mobile; bump modal z-index
src/current/_layouts/default.html Added "Rate This Page" button in sidebar for mobile; JS to close sidebar and open feedback overlay

Test plan

  • Open docs site on mobile viewport (< 480px) — verify "Rate This Page" floating button is hidden and "Ask AI" is a small icon
  • Open docs site on tablet viewport (< 992px) — same behavior
  • Open Docs Menu on mobile — verify "Rate This Page" button appears at bottom of sidebar
  • Click "Rate This Page" in sidebar — verify sidebar closes and feedback overlay opens full-width
  • Click small "Ask AI" icon on mobile — verify Kapa modal opens properly
  • Verify desktop (≥ 992px) is unchanged — both floating buttons appear as before

🤖 Generated with Claude Code

The "Rate This Page" and "Ask AI" floating buttons were overlapping and
hiding page content on mobile and tablet viewports. This fix:

- Hides the floating "Rate This Page" button on viewports < 992px and
  moves it into the Docs Menu sidebar as a full-width button that closes
  the sidebar and opens the feedback overlay full-width from the bottom
- Shrinks the Kapa "Ask AI" floating button to a 36x36px icon-only
  button on mobile/tablet so it no longer covers content
- Bumps Kapa modal z-index to 9999 to ensure it renders above all
  page elements on mobile

Resolves: EDUENG-104

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit 37b6b1a
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-api-docs/deploys/6a16846d9034ea0008005835

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit 37b6b1a
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-interactivetutorials-docs/deploys/6a16846d54d4b5000848be4c

@github-actions
Copy link
Copy Markdown

Files changed:

  • src/current/_includes/feedback-widget.html
  • src/current/_includes/head.html
  • src/current/_layouts/default.html

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Netlify Preview

Name Link
🔨 Latest commit 5fb1d6c
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/6a0d89d81dbca10008abf98c
😎 Deploy Preview https://deploy-preview-23373--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Netlify Preview

Name Link
🔨 Latest commit 37b6b1a
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/6a16846dae444b00086be75a
😎 Deploy Preview https://deploy-preview-23373--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ebembi-crdb
Copy link
Copy Markdown
Contributor

Review of PR #23373: Fix floating buttons covering content on mobile/tablet

3 files changed, +73 / -1.


Issues

1. Duplicated overlay positioning — two sources of truth

The CSS media query in feedback-widget.html:552-558 sets overlay positioning (bottom, right, left, width, max-width). The JS click handler in default.html:41-50 sets the same properties as inline styles. Inline styles will always win over the CSS rule, making the media query partially dead code. If someone later updates the CSS thinking it controls the overlay appearance, nothing will change because the inline styles take precedence.

Suggestion: Remove the redundant inline style assignments from the JS and rely on the CSS media query. The JS should only need to set display: block and z-index (if the z-index truly must differ from the CSS value).

2. Magic timeout of 400ms (default.html:40)

setTimeout(function() { ... }, 400);

This assumes the Bootstrap collapse animation completes within 400ms. If the animation duration changes or the browser is under load, the overlay could appear while the sidebar is still animating, or there could be a noticeable gap.

Suggestion: Listen for Bootstrap's hidden.bs.collapse event instead:

$(sidebar).on('hidden.bs.collapse', function() {
  // open the overlay
});
$(sidebar).collapse('hide');

3. z-index escalation (1000 → 9999 → 10000)

  • head.html:159: Kapa modal z-index bumped from 1000 to 9999
  • default.html:49: Feedback overlay gets z-index 10000 inline

Jumping to 9999/10000 makes future layering adjustments harder. If 1000 wasn't working, it's worth understanding what was on top of it rather than leapfrogging to near-max values.

Suggestion: Audit the existing z-index values in the site and pick something that fits into the existing scale (e.g., 1050 or 1100, right above Bootstrap's modal default of 1050).

4. Mixing jQuery and vanilla JS (default.html:36-51)

The handler uses document.getElementById and document.addEventListener (vanilla JS) but then calls $(sidebar).collapse('hide') (jQuery + Bootstrap). This inconsistency is minor but worth making consistent. More importantly — is jQuery guaranteed to be loaded at this point? The <script> block that loads Bootstrap is at line 70 with defer, but this inline <script> will execute when parsed.

Suggestion: Verify that jQuery and Bootstrap JS are available when this code runs. The DOMContentLoaded listener helps, but deferred scripts may not have executed yet. Consider moving this script to the bottom of the page or wrapping it in a check.

5. Excessive !important usage (head.html:193-210)

Every declaration on the Kapa button uses !important. While this is somewhat justified since it's overriding a third-party widget's inline styles, it's worth noting that this creates a maintenance burden — any future changes will also require !important.

6. Missing border-radius reset for full-width overlay

When the feedback overlay becomes full-width at the bottom of the screen on mobile, it likely retains its desktop border-radius. A full-width bottom sheet should probably have border-radius: 0 (or only top corners rounded).


Minor / Nits

  • Indentation in feedback-widget.html:549-561: The @media block is indented with 2 spaces, but it's a top-level rule inside the <style> tag. The surrounding CSS doesn't use that indentation level. Should align with the other rules.
  • The SVG in the sidebar button (default.html:31-33) is a star icon — makes sense for "Rate This Page" but confirm it matches the existing feedback widget's iconography.

What looks good

  • The breakpoint 991.98px correctly aligns with Bootstrap 4's lg breakpoint and the d-lg-none utility class.
  • The if (ov) null check in the JS prevents errors if the feedback widget hasn't loaded.
  • The approach of moving the button into the sidebar rather than removing it entirely preserves feature accessibility on mobile.
  • The PR description and test plan are thorough.

@mohini-crl mohini-crl requested a review from ebembi-crdb May 26, 2026 12:03
mohini-crl and others added 2 commits May 26, 2026 18:11
1. Remove duplicated overlay positioning — JS click handler now only
   sets display:block; all positioning handled by CSS media query
2. Replace magic 400ms setTimeout with Bootstrap hidden.bs.collapse
   event listener for reliable sidebar-to-overlay transition
3. Fix z-index escalation — Kapa modal set to 1060 (just above
   Bootstrap modal default of 1050), feedback overlay to 1070,
   fitting into the existing site z-index scale
4. Consistent jQuery usage — click handler uses jQuery throughout
   since Bootstrap collapse API requires it
5. Add comment explaining why !important is needed on Kapa button
   overrides (third-party inline styles); remove unnecessary
   bottom/right position overrides
6. Add border-radius: 12px 12px 0 0 to feedback window on mobile
   for proper bottom-sheet appearance

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mohini-crl mohini-crl merged commit eadc3ca into main May 27, 2026
6 checks passed
@mohini-crl mohini-crl deleted the fix/mobile-responsive-floating-buttons branch May 27, 2026 07:57
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.

2 participants