Skip to content

Commit 637ddfe

Browse files
authored
fix(inline-editable): add tooltips for controls (#10538)
**Related Issue:** #10536 ## Summary - add `title` attribute for controls - change message text to remove "click to" - add test
1 parent a456c22 commit 637ddfe

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"enableEditing": "Click to edit",
2+
"enableEditing": "Edit",
33
"cancelEditing": "Cancel",
44
"confirmChanges": "Save"
55
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"enableEditing": "Click to edit",
2+
"enableEditing": "Edit",
33
"cancelEditing": "Cancel",
44
"confirmChanges": "Save"
55
}

packages/calcite-components/src/components/inline-editable/inline-editable.e2e.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ describe("calcite-inline-editable", () => {
6565
}
6666
});
6767

68+
it("should set title attributes for controls", async () => {
69+
const page = await newE2EPage({
70+
html: html`<calcite-inline-editable controls editing-enabled>
71+
<calcite-input />
72+
</calcite-inline-editable>`,
73+
});
74+
75+
const buttons = await page.findAll("calcite-inline-editable >>> calcite-button");
76+
77+
expect(buttons).toHaveLength(3);
78+
79+
for (const button of buttons) {
80+
expect(await button.getProperty("title")).toBeTruthy();
81+
}
82+
});
83+
6884
it("uses a child input's scale when none are provided", async () => {
6985
page = await newE2EPage();
7086
await page.setContent(`

packages/calcite-components/src/components/inline-editable/inline-editable.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export class InlineEditable
176176
opacity: this.editingEnabled ? "0" : "1",
177177
width: this.editingEnabled ? "0" : "inherit",
178178
}}
179+
title={this.messages.enableEditing}
179180
type="button"
180181
/>
181182
{this.shouldShowControls && [
@@ -190,6 +191,7 @@ export class InlineEditable
190191
onClick={this.cancelEditingHandler}
191192
ref={(el) => (this.cancelEditingButton = el)}
192193
scale={this.scale}
194+
title={this.messages.cancelEditing}
193195
type="button"
194196
/>
195197
</div>,
@@ -204,6 +206,7 @@ export class InlineEditable
204206
onClick={this.confirmChangesHandler}
205207
ref={(el) => (this.confirmEditingButton = el)}
206208
scale={this.scale}
209+
title={this.messages.confirmChanges}
207210
type="button"
208211
/>,
209212
]}

0 commit comments

Comments
 (0)