Compare commits
13 Commits
hs/a11y-up
...
hs/remove-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3f1a8c649 | ||
|
|
57e8e51821 | ||
|
|
b4c926f85c | ||
|
|
a413ae3f43 | ||
|
|
88e52601c8 | ||
|
|
51cb4a5cfd | ||
|
|
ffedde2509 | ||
|
|
03da3b55b5 | ||
|
|
206304b5d7 | ||
|
|
956d936235 | ||
|
|
ef4d9ea8b7 | ||
|
|
5aca14db74 | ||
|
|
8a9eb35bf9 |
@@ -50,8 +50,8 @@ test.describe("Appearance user settings tab", () => {
|
||||
// Click "Show advanced" link button
|
||||
await tab.getByRole("button", { name: "Show advanced" }).click();
|
||||
|
||||
await tab.locator(".mx_Checkbox", { hasText: "Use bundled emoji font" }).click();
|
||||
await tab.locator(".mx_Checkbox", { hasText: "Use a system font" }).click();
|
||||
await tab.getByRole("switch", { name: "Use bundled emoji font" }).click();
|
||||
await tab.getByRole("switch", { name: "Use a system font" }).click();
|
||||
|
||||
// Assert that the font-family value was removed
|
||||
await expect(page.locator("body")).toHaveCSS("font-family", '""');
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 74 KiB |
@@ -8,6 +8,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
.mx_Field.mx_AppearanceUserSettingsTab_checkboxControlledField {
|
||||
width: 256px;
|
||||
/* matches checkbox box + padding to align with checkbox label */
|
||||
margin-inline-start: calc($font-16px + 10px);
|
||||
/* Line up with Settings field toggle button */
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ interface IProps {
|
||||
// If specified, contents will appear as a tooltip on the element and
|
||||
// validation feedback tooltips will be suppressed.
|
||||
tooltipContent?: JSX.Element | string;
|
||||
// If specified the tooltip will be shown regardless of feedback
|
||||
forceTooltipVisible?: boolean;
|
||||
// If specified, the tooltip with be aligned accorindly with the field, defaults to Right.
|
||||
tooltipAlignment?: ComponentProps<typeof Tooltip>["placement"];
|
||||
// If specified alongside tooltipContent, the class name to apply to the
|
||||
@@ -274,7 +272,6 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
|
||||
validateOnChange,
|
||||
validateOnFocus,
|
||||
usePlaceholderAsHint,
|
||||
forceTooltipVisible,
|
||||
tooltipAlignment,
|
||||
...inputProps
|
||||
} = this.props;
|
||||
@@ -283,7 +280,7 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
|
||||
const tooltipProps: Pick<React.ComponentProps<typeof Tooltip>, "aria-live" | "aria-atomic"> = {};
|
||||
let tooltipOpen = false;
|
||||
if (tooltipContent || this.state.feedback) {
|
||||
tooltipOpen = (this.state.focused && forceTooltipVisible) || this.state.feedbackVisible;
|
||||
tooltipOpen = this.state.feedbackVisible;
|
||||
|
||||
if (!tooltipContent) {
|
||||
tooltipProps["aria-atomic"] = "true";
|
||||
|
||||
@@ -13,7 +13,6 @@ import { secureRandomString } from "matrix-js-sdk/src/randomstring";
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import ToggleSwitch from "./ToggleSwitch";
|
||||
import StyledCheckbox from "./StyledCheckbox";
|
||||
import { type SettingLevel } from "../../../settings/SettingLevel";
|
||||
import { type BooleanSettingKey, defaultWatchManager } from "../../../settings/Settings";
|
||||
|
||||
@@ -24,8 +23,6 @@ interface IProps {
|
||||
roomId?: string; // for per-room settings
|
||||
label?: string;
|
||||
isExplicit?: boolean;
|
||||
// XXX: once design replaces all toggles make this the default
|
||||
useCheckbox?: boolean;
|
||||
hideIfCannotSet?: boolean;
|
||||
onChange?(checked: boolean): void;
|
||||
}
|
||||
@@ -80,10 +77,6 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
|
||||
this.props.onChange?.(checked);
|
||||
};
|
||||
|
||||
private checkBoxOnChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
||||
this.onChange(e.target.checked);
|
||||
};
|
||||
|
||||
private save = async (val?: boolean): Promise<void> => {
|
||||
await SettingsStore.setValue(
|
||||
this.props.name,
|
||||
@@ -101,45 +94,34 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
|
||||
const label = this.props.label ?? SettingsStore.getDisplayName(this.props.name, this.props.level);
|
||||
const description = SettingsStore.getDescription(this.props.name);
|
||||
const shouldWarn = SettingsStore.shouldHaveWarning(this.props.name);
|
||||
|
||||
if (this.props.useCheckbox) {
|
||||
return (
|
||||
<StyledCheckbox checked={this.state.value} onChange={this.checkBoxOnChange} disabled={disabled}>
|
||||
{label}
|
||||
</StyledCheckbox>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="mx_SettingsFlag">
|
||||
<label className="mx_SettingsFlag_label" htmlFor={this.id}>
|
||||
<span className="mx_SettingsFlag_labelText">{label}</span>
|
||||
{description && (
|
||||
<div className="mx_SettingsFlag_microcopy">
|
||||
{shouldWarn
|
||||
? _t(
|
||||
"settings|warning",
|
||||
{},
|
||||
{
|
||||
w: (sub) => (
|
||||
<span className="mx_SettingsTab_microcopy_warning">{sub}</span>
|
||||
),
|
||||
description,
|
||||
},
|
||||
)
|
||||
: description}
|
||||
</div>
|
||||
)}
|
||||
</label>
|
||||
<ToggleSwitch
|
||||
id={this.id}
|
||||
checked={this.state.value}
|
||||
onChange={this.onChange}
|
||||
disabled={disabled}
|
||||
tooltip={disabled ? SettingsStore.disabledMessage(this.props.name) : undefined}
|
||||
title={label ?? undefined}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="mx_SettingsFlag">
|
||||
<label className="mx_SettingsFlag_label" htmlFor={this.id}>
|
||||
<span className="mx_SettingsFlag_labelText">{label}</span>
|
||||
{description && (
|
||||
<div className="mx_SettingsFlag_microcopy">
|
||||
{shouldWarn
|
||||
? _t(
|
||||
"settings|warning",
|
||||
{},
|
||||
{
|
||||
w: (sub) => <span className="mx_SettingsTab_microcopy_warning">{sub}</span>,
|
||||
description,
|
||||
},
|
||||
)
|
||||
: description}
|
||||
</div>
|
||||
)}
|
||||
</label>
|
||||
<ToggleSwitch
|
||||
id={this.id}
|
||||
checked={this.state.value}
|
||||
onChange={this.onChange}
|
||||
disabled={disabled}
|
||||
tooltip={disabled ? SettingsStore.disabledMessage(this.props.name) : undefined}
|
||||
title={label ?? undefined}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import React, { type ChangeEvent, type ReactNode } from "react";
|
||||
import { type EmptyObject } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { _t } from "../../../../../languageHandler";
|
||||
import SdkConfig from "../../../../../SdkConfig";
|
||||
import SettingsStore from "../../../../../settings/SettingsStore";
|
||||
import SettingsFlag from "../../../elements/SettingsFlag";
|
||||
import Field from "../../../elements/Field";
|
||||
@@ -48,7 +47,6 @@ export default class AppearanceUserSettingsTab extends React.Component<EmptyObje
|
||||
private renderAdvancedSection(): ReactNode {
|
||||
if (!SettingsStore.getValue(UIFeature.AdvancedSettings)) return null;
|
||||
|
||||
const brand = SdkConfig.get().brand;
|
||||
const toggle = (
|
||||
<AccessibleButton
|
||||
kind="link"
|
||||
@@ -62,21 +60,18 @@ export default class AppearanceUserSettingsTab extends React.Component<EmptyObje
|
||||
let advanced: React.ReactNode;
|
||||
|
||||
if (this.state.showAdvanced) {
|
||||
const tooltipContent = _t("settings|appearance|custom_font_description", { brand });
|
||||
advanced = (
|
||||
<>
|
||||
<SettingsFlag name="useCompactLayout" level={SettingLevel.DEVICE} useCheckbox={true} />
|
||||
<SettingsFlag name="useCompactLayout" level={SettingLevel.DEVICE} />
|
||||
|
||||
<SettingsFlag
|
||||
name="useBundledEmojiFont"
|
||||
level={SettingLevel.DEVICE}
|
||||
useCheckbox={true}
|
||||
onChange={(checked) => this.setState({ useBundledEmojiFont: checked })}
|
||||
/>
|
||||
<SettingsFlag
|
||||
name="useSystemFont"
|
||||
level={SettingLevel.DEVICE}
|
||||
useCheckbox={true}
|
||||
onChange={(checked) => this.setState({ useSystemFont: checked })}
|
||||
/>
|
||||
<Field
|
||||
@@ -89,8 +84,6 @@ export default class AppearanceUserSettingsTab extends React.Component<EmptyObje
|
||||
|
||||
SettingsStore.setValue("systemFont", null, SettingLevel.DEVICE, value.target.value);
|
||||
}}
|
||||
tooltipContent={tooltipContent}
|
||||
forceTooltipVisible={true}
|
||||
disabled={!this.state.useSystemFont}
|
||||
value={this.state.systemFont}
|
||||
/>
|
||||
|
||||
@@ -906,6 +906,10 @@ export const SETTINGS: Settings = {
|
||||
default: false,
|
||||
displayName: _td("settings|appearance|custom_font"),
|
||||
controller: new SystemFontController(),
|
||||
description: () =>
|
||||
_t("settings|appearance|custom_font_description", {
|
||||
brand: SdkConfig.get().brand,
|
||||
}),
|
||||
},
|
||||
"systemFont": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
|
||||
Reference in New Issue
Block a user