Skip to content
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Starting from 0.2.0, CLI / Extension / DSH Plugin share the same version number.

### Fixed

- Recorded controls prefer `aria-labelledby` text over `aria-label` when both
attributes are present, so their recorded names follow accessible naming precedence.
- CLI cancellation keeps the original RPC progressing and retries cancellation
that arrives before daemon registration, reducing background screenshots that
keep a session busy after the caller stops. Confirmation and response waiting
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ BrowserSkill 的重要变更记录于此,格式参考 [Keep a Changelog](https

### 修复

- 录制的控件同时具有 `aria-labelledby` 和 `aria-label` 时,优先使用 `aria-labelledby` 引用的文本,使录制名称遵循无障碍命名优先级。
- CLI 取消时继续推进原 RPC,并重试先于 daemon 注册到达的取消请求,减少调用方停止后后台截图仍占用会话的情况。取消确认和响应等待共用两秒预算,MCP 取消也使用同一预算;文件传输清理保留独立的有限预算。超过该期限才注册的请求仍需 daemon 侧取消追踪解决([#419](https://github.com/Tencent/BrowserSkill/pull/419))。
- 保存的 HTML 调试捕获在 `autocomplete` 含首尾空白或多个令牌时(如 `section-login one-time-code` 或 `section-checkout billing cc-number`)也会对敏感输入值脱敏;`section-login email` 等非敏感令牌列表保持不变([#566](https://github.com/Tencent/BrowserSkill/pull/566))。
- 处理旧版 `mousewheel` 事件的页面(如哔哩哔哩播放器的音量调节)重新能收到滚轮输入。此前扩展即使没有共享控制会话也会在每个页面监听 `wheel`,导致 Chromium 跳过这些处理函数;现在只在采集期间于 `window` 上监听。
Expand Down
14 changes: 14 additions & 0 deletions apps/extension/src/lib/__tests__/describe-target.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ describe("describeTarget", () => {
});
});

it.each(["button", "input"])("prefers aria-labelledby over aria-label for %s", (tag) => {
document.body.innerHTML = `
<span id="context">服务</span>
<span id="action"> 发布 </span>
<${tag} aria-labelledby="action context" aria-label="旧名称"></${tag}>
`;
expect(describeTarget(document.querySelector(tag)!).name).toBe("发布 服务");
});

it("uses aria-label when aria-labelledby references a missing element", () => {
document.body.innerHTML = `<button aria-labelledby="missing" aria-label="发布">go</button>`;
expect(describeTarget(document.querySelector("button")!).name).toBe("发布");
});

it("uses label text and name_attr for inputs", () => {
document.body.innerHTML = `
<label for="svc">服务名称</label>
Expand Down
6 changes: 3 additions & 3 deletions apps/extension/src/lib/describe-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ function compactLinkName(el: Element): string | null {

/** Visible accessible name preference order for LLM textbooks. */
export function accessibleName(el: Element): string | undefined {
const ariaLabel = normalizeWhitespace(el.getAttribute("aria-label") ?? "");
if (ariaLabel) return truncate(ariaLabel);

const labelledBy = labelledByText(el);
if (labelledBy) return labelledBy;

const ariaLabel = normalizeWhitespace(el.getAttribute("aria-label") ?? "");
if (ariaLabel) return truncate(ariaLabel);

const forLabel = associatedLabelText(el);
if (forLabel) return forLabel;

Expand Down