Skip to content

Commit 9e48c72

Browse files
committed
Move toggle switch for integration manager for a11y
1 parent b6c8721 commit 9e48c72

File tree

3 files changed

+64
-41
lines changed

3 files changed

+64
-41
lines changed

res/css/views/settings/_SetIntegrationManager.pcss

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ Please see LICENSE files in the repository root for full details.
77
*/
88

99
.mx_SetIntegrationManager {
10-
.mx_SettingsFlag {
10+
.mx_SetIntegrationManager_heading_manager {
11+
display: flex;
1112
align-items: center;
12-
13-
.mx_SetIntegrationManager_heading_manager {
14-
display: flex;
15-
align-items: center;
16-
flex-wrap: wrap;
17-
column-gap: $spacing-4;
18-
}
19-
20-
.mx_ToggleSwitch {
21-
align-self: flex-start;
22-
min-width: var(--ToggleSwitch-min-width); /* avoid compression */
23-
}
13+
flex-wrap: wrap;
14+
column-gap: $spacing-4;
15+
}
16+
form {
17+
margin-top: var(--cpd-space-3x);
2418
}
2519
}

src/components/views/settings/SetIntegrationManager.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Please see LICENSE files in the repository root for full details.
99
import React from "react";
1010
import { logger } from "matrix-js-sdk/src/logger";
1111
import { type EmptyObject } from "matrix-js-sdk/src/matrix";
12+
import { Root, InlineField, Label, ToggleInput } from "@vector-im/compound-web";
1213

1314
import { _t } from "../../../languageHandler";
1415
import { IntegrationManagers } from "../../../integrations/IntegrationManagers";
1516
import { type IntegrationManagerInstance } from "../../../integrations/IntegrationManagerInstance";
1617
import SettingsStore from "../../../settings/SettingsStore";
1718
import { SettingLevel } from "../../../settings/SettingLevel";
18-
import ToggleSwitch from "../elements/ToggleSwitch";
1919
import Heading from "../typography/Heading";
2020
import { SettingsSubsectionText } from "./shared/SettingsSubsection";
2121
import { UIFeature } from "../../../settings/UIFeature";
@@ -66,26 +66,33 @@ export default class SetIntegrationManager extends React.Component<EmptyObject,
6666
if (!SettingsStore.getValue(UIFeature.Widgets)) return null;
6767

6868
return (
69-
<label
70-
className="mx_SetIntegrationManager"
71-
data-testid="mx_SetIntegrationManager"
72-
htmlFor="toggle_integration"
73-
>
69+
<div className="mx_SetIntegrationManager" data-testid="mx_SetIntegrationManager">
7470
<div className="mx_SettingsFlag">
7571
<div className="mx_SetIntegrationManager_heading_manager">
7672
<Heading size="3">{_t("integration_manager|manage_title")}</Heading>
7773
<Heading size="4">{managerName}</Heading>
7874
</div>
79-
<ToggleSwitch
80-
id="toggle_integration"
81-
checked={this.state.provisioningEnabled}
82-
disabled={false}
83-
onChange={this.onProvisioningToggled}
84-
/>
8575
</div>
8676
<SettingsSubsectionText>{bodyText}</SettingsSubsectionText>
8777
<SettingsSubsectionText>{_t("integration_manager|explainer")}</SettingsSubsectionText>
88-
</label>
78+
<Root>
79+
<InlineField
80+
name="enable_im"
81+
control={
82+
<ToggleInput
83+
role="switch"
84+
id="mx_SetIntegrationManager_Toggle"
85+
checked={this.state.provisioningEnabled}
86+
onChange={this.onProvisioningToggled}
87+
/>
88+
}
89+
>
90+
<Label htmlFor="mx_SetIntegrationManager_Toggle">
91+
{_t("integration_manager|toggle_label")}
92+
</Label>
93+
</InlineField>
94+
</Root>
95+
</div>
8996
);
9097
}
9198
}

test/unit-tests/components/views/settings/__snapshots__/SetIntegrationManager-test.tsx.snap

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`SetIntegrationManager should render manage integrations sections 1`] = `
4-
<label
4+
<div
55
class="mx_SetIntegrationManager"
66
data-testid="mx_SetIntegrationManager"
7-
for="toggle_integration"
87
>
98
<div
109
class="mx_SettingsFlag"
@@ -23,18 +22,6 @@ exports[`SetIntegrationManager should render manage integrations sections 1`] =
2322
(scalar.vector.im)
2423
</h4>
2524
</div>
26-
<div
27-
aria-checked="false"
28-
aria-disabled="false"
29-
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
30-
id="toggle_integration"
31-
role="switch"
32-
tabindex="0"
33-
>
34-
<div
35-
class="mx_ToggleSwitch_ball"
36-
/>
37-
</div>
3825
</div>
3926
<div
4027
class="mx_SettingsSubsection_text"
@@ -52,5 +39,40 @@ exports[`SetIntegrationManager should render manage integrations sections 1`] =
5239
>
5340
Integration managers receive configuration data, and can modify widgets, send room invites, and set power levels on your behalf.
5441
</div>
55-
</label>
42+
<form
43+
class="_root_19upo_16"
44+
>
45+
<div
46+
class="_inline-field_19upo_32"
47+
>
48+
<div
49+
class="_inline-field-control_19upo_44"
50+
>
51+
<div
52+
class="_container_19o42_10"
53+
>
54+
<input
55+
class="_input_19o42_24"
56+
id="mx_SetIntegrationManager_Toggle"
57+
role="switch"
58+
type="checkbox"
59+
/>
60+
<div
61+
class="_ui_19o42_34"
62+
/>
63+
</div>
64+
</div>
65+
<div
66+
class="_inline-field-body_19upo_38"
67+
>
68+
<label
69+
class="_label_19upo_59"
70+
for="mx_SetIntegrationManager_Toggle"
71+
>
72+
Enable the integration manager
73+
</label>
74+
</div>
75+
</div>
76+
</form>
77+
</div>
5678
`;

0 commit comments

Comments
 (0)