Skip to content

Commit 26430a3

Browse files
authored
Replace legacy Tooltips with Compound tooltips (#28231)
* Ditch legacy Tooltips in favour of Compound Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove dead code Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Extract markdown CodeBlock into React component Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Upgrade compound Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent fad4573 commit 26430a3

29 files changed

Lines changed: 410 additions & 670 deletions

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@
7979
"@types/seedrandom": "3.0.8",
8080
"oidc-client-ts": "3.1.0",
8181
"jwt-decode": "4.0.0",
82-
"@vector-im/compound-design-tokens": "1.8.0",
83-
"@vector-im/compound-web": "7.0.0",
8482
"@floating-ui/react": "0.26.11",
8583
"@radix-ui/react-id": "1.1.0",
8684
"caniuse-lite": "1.0.30001668",
@@ -98,7 +96,7 @@
9896
"@sentry/browser": "^8.0.0",
9997
"@testing-library/react-hooks": "^8.0.1",
10098
"@vector-im/compound-design-tokens": "^1.8.0",
101-
"@vector-im/compound-web": "^7.0.0",
99+
"@vector-im/compound-web": "^7.1.0",
102100
"@zxcvbn-ts/core": "^3.0.4",
103101
"@zxcvbn-ts/language-common": "^3.0.4",
104102
"@zxcvbn-ts/language-en": "^3.0.2",

playwright/e2e/editing/editing.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ test.describe("Editing", () => {
263263
checkA11y,
264264
}) => {
265265
axe.disableRules("color-contrast"); // XXX: We have some known contrast issues here
266-
axe.exclude(".mx_Tooltip_visible"); // XXX: this is fine but would be good to fix
267266

268267
await page.goto(`#/room/${room.roomId}`);
269268

playwright/e2e/register/register.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ test.describe("Registration", () => {
9696
});
9797
});
9898
await page.getByRole("textbox", { name: "Username", exact: true }).fill("_alice");
99-
await expect(page.getByRole("alert").filter({ hasText: "Some characters not allowed" })).toBeVisible();
99+
await expect(page.getByRole("tooltip").filter({ hasText: "Some characters not allowed" })).toBeVisible();
100100

101101
await page.route("**/_matrix/client/*/register/available?username=bob", async (route) => {
102102
await route.fulfill({
@@ -108,9 +108,9 @@ test.describe("Registration", () => {
108108
});
109109
});
110110
await page.getByRole("textbox", { name: "Username", exact: true }).fill("bob");
111-
await expect(page.getByRole("alert").filter({ hasText: "Someone already has that username" })).toBeVisible();
111+
await expect(page.getByRole("tooltip").filter({ hasText: "Someone already has that username" })).toBeVisible();
112112

113113
await page.getByRole("textbox", { name: "Username", exact: true }).fill("foobar");
114-
await expect(page.getByRole("alert")).not.toBeVisible();
114+
await expect(page.getByRole("tooltip")).not.toBeVisible();
115115
});
116116
});

playwright/element-web-test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,7 @@ export const expect = baseExpect.extend({
345345

346346
if (!options?.showTooltips) {
347347
css += `
348-
[role="tooltip"],
349-
.mx_Tooltip_visible {
348+
[role="tooltip"] {
350349
visibility: hidden !important;
351350
}
352351
`;

res/css/_components.pcss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@
217217
@import "./views/elements/_TagComposer.pcss";
218218
@import "./views/elements/_TextWithTooltip.pcss";
219219
@import "./views/elements/_ToggleSwitch.pcss";
220-
@import "./views/elements/_Tooltip.pcss";
221220
@import "./views/elements/_UseCaseSelection.pcss";
222221
@import "./views/elements/_UseCaseSelectionButton.pcss";
223222
@import "./views/elements/_Validation.pcss";

res/css/views/auth/_PassphraseField.pcss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ progress.mx_PassphraseField_progress {
1616
border: 0;
1717
height: 4px;
1818
position: absolute;
19-
top: -12px;
19+
top: -10px;
20+
left: 0;
2021

2122
@mixin ProgressBarBorderRadius "2px";
2223
@mixin ProgressBarColour $PassphraseStrengthLow;

res/css/views/elements/_Field.pcss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ Please see LICENSE files in the repository root for full details.
164164
}
165165
}
166166

167-
.mx_Field_tooltip {
168-
width: 200px;
169-
}
170-
171-
.mx_Field_tooltip.mx_Field_valid {
172-
animation: mx_fadeout 1s 2s forwards;
173-
}
174-
175167
/* Customise other components when placed inside a Field */
176168

177169
.mx_Field .mx_Dropdown_input {

res/css/views/elements/_MiniAvatarUploader.pcss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ Please see LICENSE files in the repository root for full details.
1010
position: relative;
1111
width: min-content;
1212

13-
/* this isn't a floating tooltip so override some things to not need to bother with z-index and floating */
14-
.mx_Tooltip {
15-
display: inline-block;
16-
position: absolute;
17-
z-index: unset;
18-
width: max-content;
19-
left: 72px;
20-
/* top edge starting at 50 % of parent - 50 % of itself -> centered vertically */
21-
top: 50%;
22-
transform: translateY(-50%);
23-
}
24-
2513
.mx_MiniAvatarUploader_indicator {
2614
position: absolute;
2715

res/css/views/elements/_Tooltip.pcss

Lines changed: 0 additions & 107 deletions
This file was deleted.

res/css/views/elements/_Validation.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Please see LICENSE files in the repository root for full details.
77

88
.mx_Validation {
99
position: relative;
10+
max-width: 200px;
1011
}
1112

1213
.mx_Validation_details {

0 commit comments

Comments
 (0)