fix(web): visual QA front-end items U4–U6, U13–U16 and copy list
- U4: form save failures toast the first problem and scroll/focus the first invalid field (policy draft, settings cards, resource drawers, subscription form) via lib/form-errors. - U5: FormField keeps 8px between a hint and the next label. - U6: file manager status bar keeps free space left-aligned, clear of the Agent button. - U13: move/copy dialog stops "target is the source folder / inside the source" before requesting a preview (transferTargetProblem + tests). - U14: account popover uses the solid float material. - U15/U16: inbox tile hint shortened; TMDB assign dialog uses the shared Select and labelled fields (type, TMDB ID, note). - Copy: "TMDB 已保存" spacing, API Key block no longer repeats the section title, whole-day intervals read "每 7 天", "最高级别:提示", "延后:已有计划在途", failed records show "未生成目标路径", upstream model column "默认模型". Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2ae780d2a1
commit
082c556a67
18 files changed
+130
-38
No files matched your search
@@ -0,0 +1,23 @@
|
||||
// 表单级错误定位(QA U4):保存失败时滚到第一个出错的字段并聚焦,长表单里不用自己找。
|
||||
|
||||
/** 下一帧(错误已渲染)后,在 root 里找第一个 aria-invalid 的控件或 role=alert 的提示,滚到视口中间并聚焦 */
|
||||
export function revealFirstError(root?: HTMLElement | null) {
|
||||
if (typeof window === "undefined") return;
|
||||
requestAnimationFrame(() =>
|
||||
requestAnimationFrame(() => {
|
||||
const scope: ParentNode = root ?? document;
|
||||
const el =
|
||||
scope.querySelector<HTMLElement>('[aria-invalid="true"]') ?? scope.querySelector<HTMLElement>('[role="alert"]');
|
||||
if (!el) return;
|
||||
el.scrollIntoView({ block: "center", behavior: "smooth" });
|
||||
if (el.matches("input, textarea, select, button, [tabindex]")) el.focus({ preventScroll: true });
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
/** toast 用的一句话:"有 3 处需要修改:填写模板名称" */
|
||||
export function formErrorSummary(errors: Record<string, string>): string {
|
||||
const msgs = Object.values(errors).filter(Boolean);
|
||||
if (msgs.length === 0) return "表单有错误";
|
||||
return msgs.length === 1 ? `需要修改:${msgs[0]}` : `有 ${msgs.length} 处需要修改:${msgs[0]}`;
|
||||
}
|
||||
Reference in new issue
Block a user