From 2c31da1454d7b67406accb64fb08d46db75bedb2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Jul 2026 22:31:18 +0800 Subject: [PATCH] fix(share): mobile share chrome and tabbar poster entry Use a bottom sheet share panel on small screens and add a one-tap poster button to the single-post footer tabbar extend. --- .../frontend/single-post/author-actions.css | 53 +++++++++++++++++++ assets/js/post-share.js | 8 ++- inc/helpers/aksrt-template-tags.php | 17 ++++++ 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/assets/css/frontend/single-post/author-actions.css b/assets/css/frontend/single-post/author-actions.css index 50f919fc..96fbb8e8 100644 --- a/assets/css/frontend/single-post/author-actions.css +++ b/assets/css/frontend/single-post/author-actions.css @@ -335,6 +335,59 @@ html.dark .share-item { .theme-dark .share-item[data-platform="copy"]:hover { background: rgba(255,255,255,0.06); color: #ccc; } .theme-dark .share-item[data-platform="poster"]:hover { background: rgba(245,158,11,0.12); color: #f59e0b; } +/* Narrow screens: bottom sheet so dropdown never clips off-screen */ +@media (max-width: 767px) { + .share-dropdown { + position: fixed; + left: 0; + right: 0; + bottom: 0; + top: auto; + transform: none; + width: 100%; + max-width: none; + z-index: 1200; + padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px)); + background: transparent; + } + .share-dropdown[aria-hidden="false"] { + animation: shareSheetIn 0.22s ease-out forwards; + } + @keyframes shareSheetIn { + from { opacity: 0; transform: translateY(16px); } + to { opacity: 1; transform: translateY(0); } + } + .share-dropdown__grid { + justify-content: space-around; + flex-wrap: wrap; + gap: 6px; + margin: 0 10px; + padding: 14px 12px 16px; + border-radius: 14px 14px 10px 10px; + box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.16); + } + .share-item { + min-width: 64px; + flex: 1 1 28%; + max-width: 33%; + } + #share-qrcode-box { + position: static; + margin: 10px auto 0; + transform: none; + } + body.aksrt-share-sheet-open { + overflow: hidden; + } + body.aksrt-share-sheet-open::before { + content: ''; + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.35); + z-index: 1190; + } +} + .theme-dark .post-drop-meta__menu, html.dark .post-drop-meta__menu { background: var(--surface-1, #323335); diff --git a/assets/js/post-share.js b/assets/js/post-share.js index dd0234b3..56e95fcd 100644 --- a/assets/js/post-share.js +++ b/assets/js/post-share.js @@ -135,7 +135,8 @@ function closeDropdown() { dropdown.setAttribute('aria-hidden', 'true'); - trigger.setAttribute('aria-expanded', 'false'); + triggers.forEach(function (t) { t.setAttribute('aria-expanded', 'false'); }); + document.body.classList.remove('aksrt-share-sheet-open'); if (window.AksrtShare && typeof window.AksrtShare.hideQrFallback === 'function') { window.AksrtShare.hideQrFallback(qrBox); } else if (qrBox) { @@ -152,7 +153,10 @@ } dropdown.setAttribute('aria-hidden', 'false'); - trigger.setAttribute('aria-expanded', 'true'); + triggers.forEach(function (t) { t.setAttribute('aria-expanded', 'true'); }); + if (window.matchMedia && window.matchMedia('(max-width: 767px)').matches) { + document.body.classList.add('aksrt-share-sheet-open'); + } } trigger.addEventListener('click', function (event) { diff --git a/inc/helpers/aksrt-template-tags.php b/inc/helpers/aksrt-template-tags.php index 17ee5b9a..0bcd31d8 100644 --- a/inc/helpers/aksrt-template-tags.php +++ b/inc/helpers/aksrt-template-tags.php @@ -1357,16 +1357,33 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) : endif; if ($share_on) : + $share_title = get_the_title($post_id); + $share_url = get_permalink($post_id) ?: ''; + $share_image = get_the_post_thumbnail_url($post_id, 'large') ?: ''; ?> +