Skip to content

Commit 42b23b7

Browse files
committed
fix(control-ui): show override tooltips on keyboard focus via openclaw-tooltip
1 parent 51a38c4 commit 42b23b7

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

‎ui/src/pages/sessions/view.test.ts‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,18 +1011,29 @@ describe("sessions view", () => {
10111011
);
10121012
const thinkingField = fieldByLabel("Thinking");
10131013
const reasoningField = fieldByLabel("Reasoning");
1014-
expect(thinkingField?.getAttribute("title")).toContain("thinking level override");
1014+
// The tooltip rides the focus-capable openclaw-tooltip component (hover +
1015+
// keyboard focus), not a native title attribute that never shows on focus.
1016+
const tooltipContent = (field: HTMLLabelElement | undefined) => {
1017+
const wrapper = field?.parentElement;
1018+
return wrapper?.tagName.toLowerCase() === "openclaw-tooltip"
1019+
? (wrapper as HTMLElement & { content?: string }).content
1020+
: undefined;
1021+
};
1022+
expect(tooltipContent(thinkingField)).toContain("thinking level override");
1023+
expect(tooltipContent(reasoningField)).toContain("display");
10151024
// The wrapping label stays the accessible NAME; the tooltip is exposed as
10161025
// the accessible DESCRIPTION so screen readers keep the short control name.
10171026
const thinkingSelect = thinkingField?.querySelector("select");
10181027
expect(thinkingSelect?.hasAttribute("aria-label")).toBe(false);
10191028
expect(thinkingSelect?.getAttribute("aria-description")).toContain("provider profile");
10201029
const reasoningSelect = reasoningField?.querySelector("select");
1021-
expect(reasoningField?.getAttribute("title")).toContain("display");
10221030
expect(reasoningSelect?.hasAttribute("aria-label")).toBe(false);
10231031
expect(reasoningSelect?.getAttribute("aria-description")).toContain("display");
1024-
// Fields without a tooltip stay untitled.
1025-
expect(fieldByLabel("Fast")?.hasAttribute("title")).toBe(false);
1032+
// Fields without a tooltip get neither wrapper nor description.
1033+
expect(tooltipContent(fieldByLabel("Fast"))).toBeUndefined();
1034+
expect(fieldByLabel("Fast")?.querySelector("select")?.hasAttribute("aria-description")).toBe(
1035+
false,
1036+
);
10261037
});
10271038

10281039
it("opens details for sessions without checkpoints but ignores nested control clicks", async () => {

‎ui/src/pages/sessions/view.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,8 @@ function renderOverrideSelect(params: {
849849
onChange: (value: string) => void;
850850
tooltip?: string;
851851
}) {
852-
return html`
853-
<label class="session-override-field" title=${ifDefined(params.tooltip)}>
852+
const field = html`
853+
<label class="session-override-field">
854854
<span class="session-override-field__label">${params.label}</span>
855855
<select
856856
class="session-override-field__control"
@@ -867,6 +867,13 @@ function renderOverrideSelect(params: {
867867
</select>
868868
</label>
869869
`;
870+
// openclaw-tooltip shows on keyboard focus as well as hover (a native title
871+
// attribute never appears on focus) and renders display:contents, so the
872+
// grid layout is unchanged. The label keeps the accessible name; the select
873+
// keeps the tooltip text as its accessible description.
874+
return params.tooltip
875+
? html`<openclaw-tooltip .content=${params.tooltip}>${field}</openclaw-tooltip>`
876+
: field;
870877
}
871878

872879
export function renderSessions(props: SessionsProps) {

0 commit comments

Comments
 (0)