进行了一些小修复

This commit is contained in:
2026-08-26 19:04:28 +08:00
parent 192e102275
commit 5c7fa38da8
8 changed files with 26 additions and 33 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
-9
View File
@@ -11622,15 +11622,6 @@ body.error404 {
transform-origin: top right;
}
.mobile-navbar .navbar-header {
margin-top: -58px;
margin-bottom: 10px;
}
.mobile-navbar .navbar-brand {
padding: 7px 10px;
}
.mobile-navbar .toggle-radius {
margin: 0 2px;
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -14
View File
@@ -18,9 +18,6 @@ if (!function_exists('aksrt_nav_mobile_shell')) :
if (!in_array($align, ['top', 'left', 'right'], true)) {
$align = 'left';
}
$m_layout = (string) ($ctx['mobile_layout'] ?? 'center');
$fixed = !empty($ctx['fixed']);
$touch_attr = '';
if ($align !== 'top') {
$touch_attr = ' mini-touch="mobile-nav" touch-direction="' . esc_attr($align) . '"';
@@ -30,10 +27,6 @@ if (!function_exists('aksrt_nav_mobile_shell')) :
echo '<nav' . $touch_attr . ' class="mobile-navbar visible-xs-block scroll-y mini-scrollbar '
. esc_attr($align) . '">';
if (!$fixed) {
aksrt_navbar_header($ctx);
}
$brand_name = (string) ($ctx['brand_name'] ?? get_bloginfo('name'));
$logo_inner = !empty($ctx['logo_html'])
? $ctx['logo_html']
@@ -45,7 +38,7 @@ if (!function_exists('aksrt_nav_mobile_shell')) :
. esc_attr__('关闭菜单', 'aksrt') . '"><svg class="ic-close" aria-hidden="true"><use xlink:href="#icon-close"></use></svg></button>';
echo '</div>';
aksrt_nav_mobile_content($ctx, $m_layout);
aksrt_nav_mobile_content($ctx);
if (is_active_sidebar('mobile_nav_fluid')) {
echo '<div class="mobile-nav-widget">';
@@ -64,9 +57,8 @@ if (!function_exists('aksrt_nav_mobile_content')) :
* Mobile menu list + top toggles + user box.
*
* @param array<string,mixed> $ctx
* @param string $m_layout center|left
*/
function aksrt_nav_mobile_content(array $ctx, string $m_layout = 'center'): void {
function aksrt_nav_mobile_content(array $ctx): void {
$top_btns = '';
if (in_array('m_menu', (array) ($ctx['theme_positions'] ?? []), true)) {
$top_btns .= '<a href="javascript:;" class="toggle-theme toggle-radius" id="theme-toggle-mobile" title="'
@@ -74,10 +66,6 @@ if (!function_exists('aksrt_nav_mobile_content')) :
$top_btns .= '<i class="fa fas fa-toggle-theme" aria-hidden="true"></i>';
$top_btns .= '</a>';
}
if ($m_layout !== 'center') {
$top_btns .= '<a href="javascript:;" class="toggle-radius main-search-btn" aria-label="'
. esc_attr__('打开搜索', 'aksrt') . '"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></a>';
}
if (function_exists('aksrt_get_translate_language_btn')) {
$top_btns .= aksrt_get_translate_language_btn('pull-right');
}
@@ -71,12 +71,9 @@ if (!function_exists('aksrt_navbar_header')) :
$button = '<button type="button" data-toggle-class="mobile-navbar-show" data-target="body" class="navbar-toggle" aria-label="'
. esc_attr__('打开菜单', 'aksrt') . '">';
$button .= '<i class="em12 css-icon i-menu"><i></i></i></button>';
if (($ctx['mobile_layout'] ?? 'center') === 'center') {
$button .= '<a href="javascript:;" class="navbar-toggle main-search-btn" aria-label="'
. esc_attr__('打开搜索', 'aksrt') . '">';
$button .= '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-search"></use></svg></a>';
}
echo '<div class="navbar-header">';
echo '<div class="navbar-brand">' . $logo . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -77,7 +77,6 @@ if (!function_exists('aksrt_get_header_nav_context')) :
'layout' => $layout,
'mobile_layout' => $mobile_layout,
'mobile_align' => $mobile_align,
'fixed' => $nav_fixed,
'scroll_down_hide' => (!isset($settings['nav_scroll_down_hide']) || !empty($settings['nav_scroll_down_hide'])) && $nav_fixed,
'brand_name' => $brand_name,
'logo_html' => $logo_html,
@@ -23,6 +23,8 @@ const frontendRenderer = read('src/WidgetSystem/FrontendRenderer.php')
const userRenderer = read('src/WidgetSystem/Renderers/UserRenderer.php')
const widgetCss = read('assets/widgets/frontend.css')
const headerNavbar = read('inc/helpers/header/aksrt-header-navbar.php')
const headerMobile = read('inc/helpers/header/aksrt-header-mobile.php')
const headerRender = read('inc/helpers/header/aksrt-header-render.php')
const headerUserbox = read('inc/helpers/aksrt-header-userbox.php')
const headerSearch = read('inc/helpers/header/aksrt-header-menu-search.php')
const headerCss = read('assets/css/frontend/header-userbox.css')
@@ -288,6 +290,22 @@ test('desktop header actions share one row without generic button masks', () =>
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account > li > \.sub-menu\s*\{[^}]*top:\s*calc\(100% \+ 5px\);[^}]*right:\s*0;/s)
})
test('mobile search stays inside the scroll-hiding top header', () => {
assert.match(headerNavbar, /class="navbar-toggle main-search-btn"/)
assert.doesNotMatch(headerNavbar, /mobile_layout/)
assert.doesNotMatch(headerMobile, /main-search-btn|\$m_layout|aksrt_navbar_header/)
assert.match(headerMobile, /aksrt_nav_mobile_content\(\$ctx\)/)
assert.doesNotMatch(headerRender, /'fixed'\s*=>/)
assert.doesNotMatch(legacyMainCss, /\.mobile-navbar \.navbar-(?:header|brand)/)
const topHeaderSearch = headerRender.indexOf('aksrt_navbar_header($ctx);')
const topHeaderClose = headerRender.indexOf("echo '</div></div></nav></header>';")
const mobileDrawer = headerRender.indexOf('aksrt_nav_mobile_shell($ctx);')
assert.ok(topHeaderSearch > -1 && topHeaderSearch < topHeaderClose)
assert.ok(topHeaderClose < mobileDrawer)
assert.match(legacyMainCss, /\.scroll-down\.nav-fixed \.header\.scroll-down-hide\s*\{[^}]*transform:\s*translate3d\(0, -105%, 0\);/s)
})
test('search dropdown clears the fixed header and closes from the panel lower-right', () => {
assert.match(headerCss, /\.navbar-search\s*\{[^}]*z-index:\s*1001;[^}]*transform:\s*translate3d\(0, -24px, 0\);[^}]*transition:\s*transform \.24s ease, opacity \.18s ease, visibility 0s linear \.24s;/s)
assert.match(headerCss, /\.navbar-search\.show\s*\{[^}]*opacity:\s*1;[^}]*transform:\s*translate3d\(0, 0, 0\);/s)