Skip to content

Commit eadc3ca

Browse files
authored
Merge pull request #23373 from cockroachdb/fix/mobile-responsive-floating-buttons
Fix floating buttons covering content on mobile/tablet
2 parents a109357 + 37b6b1a commit eadc3ca

3 files changed

Lines changed: 81 additions & 1 deletion

File tree

src/current/_includes/feedback-widget.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,27 @@ <h4>Explore More Documentation:</h4>
546546
margin-top: 4px;
547547
line-height: 1.4;
548548
}
549+
550+
/* Hide floating feedback button on mobile/tablet — accessible via sidebar instead */
551+
@media (max-width: 991.98px) {
552+
#sticky-rating-btn {
553+
display: none;
554+
}
555+
556+
/* When feedback overlay is opened via sidebar button on mobile, make it full-width */
557+
#feedback-overlay {
558+
bottom: 0;
559+
right: 0;
560+
left: 0;
561+
width: 100%;
562+
max-width: 100%;
563+
z-index: 1070;
564+
}
565+
566+
#feedback-window {
567+
border-radius: 12px 12px 0 0;
568+
}
569+
}
549570
</style>
550571

551572
<!-- Script -->

src/current/_includes/head.html

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
data-modal-title="CockroachDB AI"
157157
data-modal-disclaimer="This AI bot is experimental. Don't rely on it for production workloads. Always consult the official CockroachDB documentation. Interactions with this AI bot may be monitored or recorded, and your use of the AI bot is subject to the Cockroach Labs' [Terms of Use](https://www.cockroachlabs.com/website-terms-of-use/) and [Privacy policy](https://www.cockroachlabs.com/privacy/)."
158158
data-modal-y-offset="12vh"
159-
data-modal-z-index="1000"
159+
data-modal-z-index="1060"
160160
data-mcp-enabled="true"
161161
data-mcp-server-url="https://cockroachdb.mcp.kapa.ai"
162162
data-search-mode-enabled="true"
@@ -186,4 +186,28 @@
186186
max-height: calc(90vh); /* Maximum height utilization on small screens */
187187
}
188188
}
189+
190+
/*
191+
* Shrink Kapa floating button to icon-only on mobile/tablet.
192+
* !important is required here to override inline styles injected
193+
* by the third-party Kapa widget script.
194+
*/
195+
@media (max-width: 991.98px) {
196+
[id^="kapa-widget-container"] button {
197+
width: 36px !important;
198+
height: 36px !important;
199+
min-width: 36px !important;
200+
padding: 0 !important;
201+
font-size: 0 !important;
202+
}
203+
204+
[id^="kapa-widget-container"] button svg {
205+
width: 18px !important;
206+
height: 18px !important;
207+
}
208+
209+
[id^="kapa-widget-container"] button span {
210+
display: none !important;
211+
}
212+
}
189213
</style>

src/current/_layouts/default.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,41 @@
2727
{%- assign sidebar_class = "nav--search " -%}
2828
{%- endif -%}
2929
{% include_cached sidebar.html sidebar_class=sidebar_class %}
30+
<!-- Mobile-only action buttons: Ask AI & Rate This Page -->
31+
<div class="sidebar-mobile-actions d-lg-none border-top mt-2 pt-2 px-3 pb-3">
32+
<button type="button" class="btn btn-sm btn-outline-secondary w-100" id="sidebar-rate-page-btn">
33+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 16 16" class="mr-1" style="vertical-align: -2px;">
34+
<path fill="currentColor" d="M7.538 1.11a.5.5 0 0 1 .924 0l1.537 3.696a.5.5 0 0 0 .421.306l3.99.32a.5.5 0 0 1 .285.878l-3.04 2.604a.5.5 0 0 0-.16.496l.928 3.893a.5.5 0 0 1-.747.542L8.261 11.76a.5.5 0 0 0-.522 0l-3.415 2.086a.5.5 0 0 1-.747-.542l.928-3.893a.5.5 0 0 0-.16-.496L1.304 6.31a.5.5 0 0 1 .285-.878l3.99-.32A.5.5 0 0 0 6 4.806L7.538 1.11Z"></path>
35+
</svg> Rate This Page
36+
</button>
37+
</div>
38+
<script>
39+
document.addEventListener('DOMContentLoaded', function() {
40+
var rateBtn = document.getElementById('sidebar-rate-page-btn');
41+
if (!rateBtn) return;
42+
43+
rateBtn.addEventListener('click', function(e) {
44+
e.preventDefault();
45+
e.stopPropagation();
46+
47+
var $sidebar = $('#sidebarMenu');
48+
49+
function openFeedback() {
50+
var ov = document.getElementById('feedback-overlay');
51+
if (ov) {
52+
ov.style.display = 'block';
53+
}
54+
}
55+
56+
if ($sidebar.hasClass('show')) {
57+
$sidebar.one('hidden.bs.collapse', openFeedback);
58+
$sidebar.collapse('hide');
59+
} else {
60+
openFeedback();
61+
}
62+
});
63+
});
64+
</script>
3065
</nav>
3166
{% if page.toc == true %}
3267
{% if page.homepage != true %}

0 commit comments

Comments
 (0)