Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion e2e/remediation-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@ test('F06 已验收工单返工:归档旧验收 → 再完成 → 再验收',
await page.keyboard.press('Escape');
await navigate(page, '/components/signature');
await page.getByRole('combobox').first().click();
await page.locator('.ant-select-item-option', { hasText: 'WO-SCN-REWORK' }).click();
// 候选按创建时间倒序,下拉是虚拟列表(只渲染可视的约 10 项)。排在这张工单前面的近期工单数随当天时刻
// 与时区变化(演示数据按本地自然日生成;CI 为 UTC 时它常落在第 10 项之后),用滚轮逐屏翻到它渲染出来再点
const option = page.locator('.ant-select-item-option', { hasText: 'WO-SCN-REWORK' });
const dropdown = page.locator('.ant-select-dropdown:visible');
await expect(async () => {
if (!(await option.count())) {
await dropdown.hover();
await page.mouse.wheel(0, 240);
}
await expect(option).toBeVisible({ timeout: 500 });
}).toPass({ timeout: 15_000 });
await option.click();
// getByText 会先命中 select 的 aria-live 隐藏区,断言可见的选中项
await expect(page.locator('.ant-select', { hasText: 'WO-SCN-REWORK' }).first()).toBeVisible();
});
1 change: 1 addition & 0 deletions src/components/GroupNav/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vi.mock('@umijs/max', () => ({
vi.mock('antd', async () => {
const React = await import('react');
return {
ConfigProvider: ({ children }: { children?: React.ReactNode }) => children,
Menu: (props: { selectedKeys?: string[]; items?: { key: string; label?: string }[] }) => {
menuProps.last = props;
return React.createElement(
Expand Down
43 changes: 24 additions & 19 deletions src/components/GroupNav/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { canAccessRoute, groupOf, matchedKey, useNamedChain, type NavRoute } from '@/utils/routeNav';
import { history, useAccess, useIntl, useLocation } from '@umijs/max';
import { Menu, theme } from 'antd';
import { ConfigProvider, Menu, theme } from 'antd';
import { useEffect, useRef } from 'react';

/**
Expand Down Expand Up @@ -71,24 +71,29 @@ export default function GroupNav() {
}}
>
<div ref={scroller} className="min-w-0 flex-1" style={{ overflowX: 'auto', scrollbarWidth: 'none' }}>
<Menu
mode="horizontal"
disabledOverflow
selectedKeys={selected ? [selected] : []}
items={items}
onClick={({ key }) => {
if (key !== pathname) {
history.push(key);
window.scrollTo(0, 0);
}
}}
style={{
borderBottom: 'none',
background: 'transparent',
minWidth: 0,
lineHeight: '40px',
}}
/>
{/* 选中页签文字(及底部指示条)antd 默认取 colorPrimary:暗色派生 #1668dc 压在 #141414 上只有 3.55:1
(axe color-contrast)。改用 colorLink:浅色两者同为 #0958d9 不变,暗色为 #5c99dc 6.18:1
(见 styles/themeTokens.ts)。取运行时 token 而非写死色值,冷启动与顶栏热切换都跟随当前主题 */}
<ConfigProvider theme={{ components: { Menu: { horizontalItemSelectedColor: token.colorLink } } }}>
<Menu
mode="horizontal"
disabledOverflow
selectedKeys={selected ? [selected] : []}
items={items}
onClick={({ key }) => {
if (key !== pathname) {
history.push(key);
window.scrollTo(0, 0);
}
}}
style={{
borderBottom: 'none',
background: 'transparent',
minWidth: 0,
lineHeight: '40px',
}}
/>
</ConfigProvider>
</div>
<span
className="hidden self-center text-xs font-medium tracking-wider whitespace-nowrap uppercase md:inline"
Expand Down
10 changes: 10 additions & 0 deletions tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,13 @@ div.ant-spin-description {
main.ant-pro-layout-content:has([data-tour='groupnav']) {
padding: 0 !important;
}

/*
* ProLayout 在 fixedHeader(及 mix 布局)下会在真正的顶栏前插一个空的透明 <header> 占位撑开 56px,
* 它和顶栏都是页面级 <header>,读屏器的地标列表里多出一个空「横幅」(axe landmark-no-duplicate-banner /
* landmark-unique)。组件没有给占位传属性的口子:visibility: hidden 把它移出无障碍树,而盒子高度照旧
* 占位(visibility 不影响布局);它本来就是透明空元素,视觉无变化。
*/
header.ant-layout-header:has(+ header[data-testid='pro-layout-header']) {
visibility: hidden;
}
Loading