Field: make id optional, generate one if not provided

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-03-29 22:59:15 +01:00
parent 7bdd22ae03
commit 19aae087e0
31 changed files with 36 additions and 57 deletions

View file

@ -168,7 +168,6 @@ export default class ManageEventIndexDialog extends React.Component {
totalRooms: formatCountLong(this.state.roomCount), totalRooms: formatCountLong(this.state.roomCount),
})} <br /> })} <br />
<Field <Field
id={"crawlerSleepTimeMs"}
label={_t('Message downloading sleep time(ms)')} label={_t('Message downloading sleep time(ms)')}
type='number' type='number'
value={this.state.crawlerSleepTime} value={this.state.crawlerSleepTime}

View file

@ -412,7 +412,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
<div>{_t("Enter your account password to confirm the upgrade:")}</div> <div>{_t("Enter your account password to confirm the upgrade:")}</div>
<div><Field <div><Field
type="password" type="password"
id="mx_CreateSecretStorage_accountPassword"
label={_t("Password")} label={_t("Password")}
value={this.state.accountPassword} value={this.state.accountPassword}
onChange={this._onAccountPasswordChange} onChange={this._onAccountPasswordChange}
@ -497,7 +496,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
<div className="mx_CreateSecretStorageDialog_passPhraseContainer"> <div className="mx_CreateSecretStorageDialog_passPhraseContainer">
<Field <Field
type="password" type="password"
id="mx_CreateSecretStorageDialog_passPhraseField"
className="mx_CreateSecretStorageDialog_passPhraseField" className="mx_CreateSecretStorageDialog_passPhraseField"
onChange={this._onPassPhraseChange} onChange={this._onPassPhraseChange}
value={this.state.passPhrase} value={this.state.passPhrase}
@ -574,7 +572,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
<div className="mx_CreateSecretStorageDialog_passPhraseContainer"> <div className="mx_CreateSecretStorageDialog_passPhraseContainer">
<Field <Field
type="password" type="password"
id="mx_CreateSecretStorageDialog_passPhraseField"
onChange={this._onPassPhraseConfirmChange} onChange={this._onPassPhraseConfirmChange}
value={this.state.passPhraseConfirm} value={this.state.passPhraseConfirm}
className="mx_CreateSecretStorageDialog_passPhraseField" className="mx_CreateSecretStorageDialog_passPhraseField"

View file

@ -296,7 +296,6 @@ export default createReactClass({
<form onSubmit={this.onSubmitForm}> <form onSubmit={this.onSubmitForm}>
<div className="mx_AuthBody_fieldRow"> <div className="mx_AuthBody_fieldRow">
<Field <Field
id="mx_ForgotPassword_email"
name="reset_email" // define a name so browser's password autofill gets less confused name="reset_email" // define a name so browser's password autofill gets less confused
type="text" type="text"
label={_t('Email')} label={_t('Email')}
@ -307,7 +306,6 @@ export default createReactClass({
</div> </div>
<div className="mx_AuthBody_fieldRow"> <div className="mx_AuthBody_fieldRow">
<Field <Field
id="mx_ForgotPassword_password"
name="reset_password" name="reset_password"
type="password" type="password"
label={_t('Password')} label={_t('Password')}
@ -315,7 +313,6 @@ export default createReactClass({
onChange={this.onInputChanged.bind(this, "password")} onChange={this.onInputChanged.bind(this, "password")}
/> />
<Field <Field
id="mx_ForgotPassword_passwordConfirm"
name="reset_password_confirm" name="reset_password_confirm"
type="password" type="password"
label={_t('Confirm')} label={_t('Confirm')}

View file

@ -213,7 +213,6 @@ export default class SoftLogout extends React.Component {
<p>{introText}</p> <p>{introText}</p>
{error} {error}
<Field <Field
id="softlogout_password"
type="password" type="password"
label={_t("Password")} label={_t("Password")}
onChange={this.onPasswordChange} onChange={this.onPasswordChange}

View file

@ -145,7 +145,6 @@ export const PasswordAuthEntry = createReactClass({
<p>{ _t("Confirm your identity by entering your account password below.") }</p> <p>{ _t("Confirm your identity by entering your account password below.") }</p>
<form onSubmit={this._onSubmit} className="mx_InteractiveAuthEntryComponents_passwordSection"> <form onSubmit={this._onSubmit} className="mx_InteractiveAuthEntryComponents_passwordSection">
<Field <Field
id="mx_InteractiveAuthEntryComponents_password"
className={passwordBoxClass} className={passwordBoxClass}
type="password" type="password"
name="passwordField" name="passwordField"

View file

@ -106,7 +106,8 @@ export default class ModularServerConfig extends ServerConfig {
)} )}
<form onSubmit={this.onSubmit} autoComplete="off" action={null}> <form onSubmit={this.onSubmit} autoComplete="off" action={null}>
<div className="mx_ServerConfig_fields"> <div className="mx_ServerConfig_fields">
<Field id="mx_ServerConfig_hsUrl" <Field
id="mx_ServerConfig_hsUrl"
label={_t("Server Name")} label={_t("Server Name")}
placeholder={this.props.serverConfig.hsUrl} placeholder={this.props.serverConfig.hsUrl}
value={this.state.hsUrl} value={this.state.hsUrl}

View file

@ -193,7 +193,6 @@ export default class PasswordLogin extends React.Component {
classes.error = this.props.loginIncorrect && !this.state.username; classes.error = this.props.loginIncorrect && !this.state.username;
return <Field return <Field
className={classNames(classes)} className={classNames(classes)}
id="mx_PasswordLogin_email"
name="username" // make it a little easier for browser's remember-password name="username" // make it a little easier for browser's remember-password
key="email_input" key="email_input"
type="text" type="text"
@ -209,7 +208,6 @@ export default class PasswordLogin extends React.Component {
classes.error = this.props.loginIncorrect && !this.state.username; classes.error = this.props.loginIncorrect && !this.state.username;
return <Field return <Field
className={classNames(classes)} className={classNames(classes)}
id="mx_PasswordLogin_username"
name="username" // make it a little easier for browser's remember-password name="username" // make it a little easier for browser's remember-password
key="username_input" key="username_input"
type="text" type="text"
@ -233,7 +231,6 @@ export default class PasswordLogin extends React.Component {
return <Field return <Field
className={classNames(classes)} className={classNames(classes)}
id="mx_PasswordLogin_phoneNumber"
name="phoneNumber" name="phoneNumber"
key="phone_input" key="phone_input"
type="text" type="text"
@ -290,7 +287,6 @@ export default class PasswordLogin extends React.Component {
<div className="mx_Login_type_container"> <div className="mx_Login_type_container">
<label className="mx_Login_type_label">{ _t('Sign in with') }</label> <label className="mx_Login_type_label">{ _t('Sign in with') }</label>
<Field <Field
id="mx_PasswordLogin_type"
element="select" element="select"
value={this.state.loginType} value={this.state.loginType}
onChange={this.onLoginTypeChange} onChange={this.onLoginTypeChange}
@ -328,7 +324,6 @@ export default class PasswordLogin extends React.Component {
{loginField} {loginField}
<Field <Field
className={pwFieldClass} className={pwFieldClass}
id="mx_PasswordLogin_password"
type="password" type="password"
name="password" name="password"
label={_t('Password')} label={_t('Password')}

View file

@ -470,7 +470,6 @@ export default createReactClass({
_t("Email") : _t("Email") :
_t("Email (optional)"); _t("Email (optional)");
return <Field return <Field
id="mx_RegistrationForm_email"
ref={field => this[FIELD_EMAIL] = field} ref={field => this[FIELD_EMAIL] = field}
type="text" type="text"
label={emailPlaceholder} label={emailPlaceholder}
@ -524,7 +523,6 @@ export default createReactClass({
onOptionChange={this.onPhoneCountryChange} onOptionChange={this.onPhoneCountryChange}
/>; />;
return <Field return <Field
id="mx_RegistrationForm_phoneNumber"
ref={field => this[FIELD_PHONE_NUMBER] = field} ref={field => this[FIELD_PHONE_NUMBER] = field}
type="text" type="text"
label={phoneLabel} label={phoneLabel}

View file

@ -223,7 +223,8 @@ export default class ServerConfig extends React.PureComponent {
{sub} {sub}
</a>, </a>,
})} })}
<Field id="mx_ServerConfig_hsUrl" <Field
id="mx_ServerConfig_hsUrl"
label={_t("Homeserver URL")} label={_t("Homeserver URL")}
placeholder={this.props.serverConfig.hsUrl} placeholder={this.props.serverConfig.hsUrl}
value={this.state.hsUrl} value={this.state.hsUrl}
@ -246,7 +247,7 @@ export default class ServerConfig extends React.PureComponent {
{sub} {sub}
</a>, </a>,
})} })}
<Field id="mx_ServerConfig_isUrl" <Field
label={_t("Identity Server URL")} label={_t("Identity Server URL")}
placeholder={this.props.serverConfig.isUrl} placeholder={this.props.serverConfig.isUrl}
value={this.state.isUrl || ''} value={this.state.isUrl || ''}

View file

@ -166,7 +166,6 @@ export default class BugReportDialog extends React.Component {
) } ) }
</b></p> </b></p>
<Field <Field
id="mx_BugReportDialog_issueUrl"
type="text" type="text"
className="mx_BugReportDialog_field_input" className="mx_BugReportDialog_field_input"
label={_t("GitHub issue")} label={_t("GitHub issue")}
@ -175,7 +174,6 @@ export default class BugReportDialog extends React.Component {
placeholder="https://github.com/vector-im/riot-web/issues/..." placeholder="https://github.com/vector-im/riot-web/issues/..."
/> />
<Field <Field
id="mx_BugReportDialog_notes"
className="mx_BugReportDialog_field_input" className="mx_BugReportDialog_field_input"
element="textarea" element="textarea"
label={_t("Notes")} label={_t("Notes")}

View file

@ -174,7 +174,7 @@ export default createReactClass({
const domain = MatrixClientPeg.get().getDomain(); const domain = MatrixClientPeg.get().getDomain();
aliasField = ( aliasField = (
<div className="mx_CreateRoomDialog_aliasContainer"> <div className="mx_CreateRoomDialog_aliasContainer">
<RoomAliasField id="alias" ref={ref => this._aliasFieldRef = ref} onChange={this.onAliasChange} domain={domain} value={this.state.alias} /> <RoomAliasField ref={ref => this._aliasFieldRef = ref} onChange={this.onAliasChange} domain={domain} value={this.state.alias} />
</div> </div>
); );
} else { } else {
@ -188,8 +188,8 @@ export default createReactClass({
> >
<form onSubmit={this.onOk} onKeyDown={this._onKeyDown}> <form onSubmit={this.onOk} onKeyDown={this._onKeyDown}>
<div className="mx_Dialog_content"> <div className="mx_Dialog_content">
<Field id="name" ref={ref => this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> <Field ref={ref => this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" />
<Field id="topic" label={ _t('Topic (optional)') } onChange={this.onTopicChange} value={this.state.topic} /> <Field label={ _t('Topic (optional)') } onChange={this.onTopicChange} value={this.state.topic} />
<LabelledToggleSwitch label={ _t("Make this room public")} onChange={this.onPublicChange} value={this.state.isPublic} /> <LabelledToggleSwitch label={ _t("Make this room public")} onChange={this.onPublicChange} value={this.state.isPublic} />
{ privateLabel } { privateLabel }
{ publicLabel } { publicLabel }

View file

@ -174,7 +174,6 @@ export default class DeactivateAccountDialog extends React.Component {
<p>{ _t("To continue, please enter your password:") }</p> <p>{ _t("To continue, please enter your password:") }</p>
<Field <Field
id="mx_DeactivateAccountDialog_password"
type="password" type="password"
label={_t('Password')} label={_t('Password')}
onChange={this._onPasswordFieldChange} onChange={this._onPasswordFieldChange}

View file

@ -302,7 +302,7 @@ class FilteredList extends React.PureComponent {
render() { render() {
const TruncatedList = sdk.getComponent("elements.TruncatedList"); const TruncatedList = sdk.getComponent("elements.TruncatedList");
return <div> return <div>
<Field id="DevtoolsDialog_FilteredList_filter" label={_t('Filter results')} autoFocus={true} size={64} <Field label={_t('Filter results')} autoFocus={true} size={64}
type="text" autoComplete="off" value={this.props.query} onChange={this.onQuery} type="text" autoComplete="off" value={this.props.query} onChange={this.onQuery}
className="mx_TextInputDialog_input mx_DevTools_RoomStateExplorer_query" className="mx_TextInputDialog_input mx_DevTools_RoomStateExplorer_query"
// force re-render so that autoFocus is applied when this component is re-used // force re-render so that autoFocus is applied when this component is re-used

View file

@ -123,7 +123,6 @@ export default class ReportEventDialog extends PureComponent {
</p> </p>
{adminMessage} {adminMessage}
<Field <Field
id="mx_ReportEventDialog_reason"
className="mx_ReportEventDialog_reason" className="mx_ReportEventDialog_reason"
element="textarea" element="textarea"
label={_t("Reason")} label={_t("Reason")}

View file

@ -116,7 +116,6 @@ export default createReactClass({
</div> </div>
<div> <div>
<Field <Field
id="mx_TextInputDialog_field"
className="mx_TextInputDialog_input" className="mx_TextInputDialog_input"
ref={this._field} ref={this._field}
type="text" type="text"

View file

@ -121,7 +121,7 @@ export default class EditableItemList extends React.Component {
return ( return (
<form onSubmit={this._onItemAdded} autoComplete="off" <form onSubmit={this._onItemAdded} autoComplete="off"
noValidate={true} className="mx_EditableItemList_newItem"> noValidate={true} className="mx_EditableItemList_newItem">
<Field id={`mx_EditableItemList_new_${this.props.id}`} label={this.props.placeholder} type="text" <Field label={this.props.placeholder} type="text"
autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged} autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged}
list={this.props.suggestionsListId} /> list={this.props.suggestionsListId} />
<AccessibleButton onClick={this._onItemAdded} kind="primary" type="submit"> <AccessibleButton onClick={this._onItemAdded} kind="primary" type="submit">

View file

@ -23,9 +23,15 @@ import { debounce } from 'lodash';
// Invoke validation from user input (when typing, etc.) at most once every N ms. // Invoke validation from user input (when typing, etc.) at most once every N ms.
const VALIDATION_THROTTLE_MS = 200; const VALIDATION_THROTTLE_MS = 200;
const BASE_ID = "mx_Field";
let count = 1;
function getId() {
return `${BASE_ID}_${count++}`;
}
export default class Field extends React.PureComponent { export default class Field extends React.PureComponent {
static propTypes = { static propTypes = {
// The field's ID, which binds the input and label together. // The field's ID, which binds the input and label together. Immutable.
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
// The element to create. Defaults to "input". // The element to create. Defaults to "input".
// To define options for a select, use <Field><option ... /></Field> // To define options for a select, use <Field><option ... /></Field>
@ -70,6 +76,8 @@ export default class Field extends React.PureComponent {
feedback: undefined, feedback: undefined,
focused: false, focused: false,
}; };
this.id = this.props.id || getId();
} }
onFocus = (ev) => { onFocus = (ev) => {
@ -167,6 +175,7 @@ export default class Field extends React.PureComponent {
inputProps.type = inputProps.type || "text"; inputProps.type = inputProps.type || "text";
inputProps.ref = input => this.input = input; inputProps.ref = input => this.input = input;
inputProps.placeholder = inputProps.placeholder || inputProps.label; inputProps.placeholder = inputProps.placeholder || inputProps.label;
inputProps.id = this.id; // this overwrites the id from props
inputProps.onFocus = this.onFocus; inputProps.onFocus = this.onFocus;
inputProps.onChange = this.onChange; inputProps.onChange = this.onChange;
@ -211,7 +220,7 @@ export default class Field extends React.PureComponent {
return <div className={fieldClasses}> return <div className={fieldClasses}>
{prefixContainer} {prefixContainer}
{fieldInput} {fieldInput}
<label htmlFor={this.props.id}>{this.props.label}</label> <label htmlFor={this.id}>{this.props.label}</label>
{postfixContainer} {postfixContainer}
{fieldTooltip} {fieldTooltip}
</div>; </div>;

View file

@ -132,7 +132,7 @@ export default createReactClass({
const label = typeof this.props.label === "undefined" ? _t("Power level") : this.props.label; const label = typeof this.props.label === "undefined" ? _t("Power level") : this.props.label;
if (this.state.custom) { if (this.state.custom) {
picker = ( picker = (
<Field id={`powerSelector_custom_${this.props.powerLevelKey}`} type="number" <Field type="number"
label={label} max={this.props.maxValue} label={label} max={this.props.maxValue}
onBlur={this.onCustomBlur} onKeyDown={this.onCustomKeyDown} onChange={this.onCustomChange} onBlur={this.onCustomBlur} onKeyDown={this.onCustomKeyDown} onChange={this.onCustomChange}
value={String(this.state.customValue)} disabled={this.props.disabled} /> value={String(this.state.customValue)} disabled={this.props.disabled} />
@ -151,7 +151,7 @@ export default createReactClass({
}); });
picker = ( picker = (
<Field id={`powerSelector_notCustom_${this.props.powerLevelKey}`} element="select" <Field element="select"
label={label} onChange={this.onSelectChange} label={label} onChange={this.onSelectChange}
value={String(this.state.selectValue)} disabled={this.props.disabled}> value={String(this.state.selectValue)} disabled={this.props.disabled}>
{options} {options}

View file

@ -23,7 +23,6 @@ import {MatrixClientPeg} from '../../../MatrixClientPeg';
// Controlled form component wrapping Field for inputting a room alias scoped to a given domain // Controlled form component wrapping Field for inputting a room alias scoped to a given domain
export default class RoomAliasField extends React.PureComponent { export default class RoomAliasField extends React.PureComponent {
static propTypes = { static propTypes = {
id: PropTypes.string.isRequired,
domain: PropTypes.string.isRequired, domain: PropTypes.string.isRequired,
onChange: PropTypes.func, onChange: PropTypes.func,
value: PropTypes.string.isRequired, value: PropTypes.string.isRequired,
@ -50,7 +49,6 @@ export default class RoomAliasField extends React.PureComponent {
className="mx_RoomAliasField" className="mx_RoomAliasField"
prefix={poundSign} prefix={poundSign}
postfix={domain} postfix={domain}
id={this.props.id}
ref={ref => this._fieldRef = ref} ref={ref => this._fieldRef = ref}
onValidate={this._onValidate} onValidate={this._onValidate}
placeholder={_t("e.g. my-room")} placeholder={_t("e.g. my-room")}

View file

@ -62,7 +62,6 @@ class EditableAliasesList extends EditableItemList {
className="mx_EditableItemList_newItem" className="mx_EditableItemList_newItem"
> >
<RoomAliasField <RoomAliasField
id={`mx_EditableItemList_new_${this.props.id}`}
ref={this._aliasField} ref={this._aliasField}
onChange={onChange} onChange={onChange}
value={this.props.newItem || ""} value={this.props.newItem || ""}

View file

@ -155,7 +155,7 @@ export default class RoomProfileSettings extends React.Component {
onChange={this._onAvatarChanged} accept="image/*" /> onChange={this._onAvatarChanged} accept="image/*" />
<div className="mx_ProfileSettings_profile"> <div className="mx_ProfileSettings_profile">
<div className="mx_ProfileSettings_controls"> <div className="mx_ProfileSettings_controls">
<Field id="profileDisplayName" label={_t("Room Name")} <Field label={_t("Room Name")}
type="text" value={this.state.displayName} autoComplete="off" type="text" value={this.state.displayName} autoComplete="off"
onChange={this._onDisplayNameChanged} disabled={!this.state.canSetName} /> onChange={this._onDisplayNameChanged} disabled={!this.state.canSetName} />
<Field id="profileTopic" label={_t("Room Topic")} disabled={!this.state.canSetTopic} <Field id="profileTopic" label={_t("Room Topic")} disabled={!this.state.canSetTopic}

View file

@ -235,7 +235,7 @@ export default createReactClass({
if (!this.state.cachedPassword) { if (!this.state.cachedPassword) {
currentPassword = ( currentPassword = (
<div className={rowClassName}> <div className={rowClassName}>
<Field id="mx_ChangePassword_oldPassword" <Field
type="password" type="password"
label={_t('Current password')} label={_t('Current password')}
value={this.state.oldPassword} value={this.state.oldPassword}
@ -254,7 +254,6 @@ export default createReactClass({
{ currentPassword } { currentPassword }
<div className={rowClassName}> <div className={rowClassName}>
<Field <Field
id="mx_ChangePassword_newPassword"
type="password" type="password"
label={passwordLabel} label={passwordLabel}
value={this.state.newPassword} value={this.state.newPassword}
@ -265,7 +264,6 @@ export default createReactClass({
</div> </div>
<div className={rowClassName}> <div className={rowClassName}>
<Field <Field
id="mx_ChangePassword_newPasswordConfirm"
type="password" type="password"
label={_t("Confirm password")} label={_t("Confirm password")}
value={this.state.newPasswordConfirm} value={this.state.newPasswordConfirm}

View file

@ -153,7 +153,7 @@ export default class ProfileSettings extends React.Component {
{this.state.userId} {this.state.userId}
{hostingSignup} {hostingSignup}
</p> </p>
<Field id="profileDisplayName" label={_t("Display Name")} <Field label={_t("Display Name")}
type="text" value={this.state.displayName} autoComplete="off" type="text" value={this.state.displayName} autoComplete="off"
onChange={this._onDisplayNameChanged} /> onChange={this._onDisplayNameChanged} />
</div> </div>

View file

@ -403,8 +403,8 @@ export default class SetIdServer extends React.Component {
<span className="mx_SettingsTab_subsectionText"> <span className="mx_SettingsTab_subsectionText">
{bodyText} {bodyText}
</span> </span>
<Field label={_t("Enter a new identity server")} <Field
id="mx_SetIdServer_idServer" label={_t("Enter a new identity server")}
type="text" type="text"
autoComplete="off" autoComplete="off"
placeholder={this.state.defaultIdServer} placeholder={this.state.defaultIdServer}

View file

@ -237,7 +237,7 @@ export default class EmailAddresses extends React.Component {
{existingEmailElements} {existingEmailElements}
<form onSubmit={this._onAddClick} autoComplete="off" <form onSubmit={this._onAddClick} autoComplete="off"
noValidate={true} className="mx_EmailAddresses_new"> noValidate={true} className="mx_EmailAddresses_new">
<Field id="mx_EmailAddressses_newEmailAddress" <Field
type="text" type="text"
label={_t("Email Address")} label={_t("Email Address")}
autoComplete="off" autoComplete="off"

View file

@ -232,7 +232,7 @@ export default class PhoneNumbers extends React.Component {
{this.state.verifyError} {this.state.verifyError}
</div> </div>
<form onSubmit={this._onContinueClick} autoComplete="off" noValidate={true}> <form onSubmit={this._onContinueClick} autoComplete="off" noValidate={true}>
<Field id="mx_PhoneNumbers_newPhoneNumberCode" <Field
type="text" type="text"
label={_t("Verification code")} label={_t("Verification code")}
autoComplete="off" autoComplete="off"
@ -262,7 +262,7 @@ export default class PhoneNumbers extends React.Component {
{existingPhoneElements} {existingPhoneElements}
<form onSubmit={this._onAddClick} autoComplete="off" noValidate={true} className="mx_PhoneNumbers_new"> <form onSubmit={this._onAddClick} autoComplete="off" noValidate={true} className="mx_PhoneNumbers_new">
<div className="mx_PhoneNumbers_input"> <div className="mx_PhoneNumbers_input">
<Field id="mx_PhoneNumbers_newPhoneNumber" <Field
type="text" type="text"
label={_t("Phone Number")} label={_t("Phone Number")}
autoComplete="off" autoComplete="off"

View file

@ -208,7 +208,7 @@ export class PhoneNumber extends React.Component {
{this.state.verifyError} {this.state.verifyError}
</span> </span>
<form onSubmit={this.onContinueClick} autoComplete="off" noValidate={true}> <form onSubmit={this.onContinueClick} autoComplete="off" noValidate={true}>
<Field id="mx_PhoneNumbers_newPhoneNumberCode" <Field
type="text" type="text"
label={_t("Verification code")} label={_t("Verification code")}
autoComplete="off" autoComplete="off"

View file

@ -422,7 +422,6 @@ export default class GeneralUserSettingsTab extends React.Component {
<Field <Field
label={_t("Custom theme URL")} label={_t("Custom theme URL")}
type='text' type='text'
id='mx_GeneralUserSettingsTab_customThemeInput'
autoComplete="off" autoComplete="off"
onChange={this._onCustomThemeChange} onChange={this._onCustomThemeChange}
value={this.state.customThemeUrl} value={this.state.customThemeUrl}
@ -448,7 +447,7 @@ export default class GeneralUserSettingsTab extends React.Component {
<div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_themeSection"> <div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_themeSection">
<span className="mx_SettingsTab_subheading">{_t("Theme")}</span> <span className="mx_SettingsTab_subheading">{_t("Theme")}</span>
{systemThemeSection} {systemThemeSection}
<Field id="theme" label={_t("Theme")} element="select" <Field label={_t("Theme")} element="select"
value={this.state.theme} onChange={this._onThemeChange} value={this.state.theme} onChange={this._onThemeChange}
disabled={this.state.useSystemTheme} disabled={this.state.useSystemTheme}
> >

View file

@ -272,7 +272,6 @@ export default class MjolnirUserSettingsTab extends React.Component {
<div> <div>
<form onSubmit={this._onAddPersonalRule} autoComplete="off"> <form onSubmit={this._onAddPersonalRule} autoComplete="off">
<Field <Field
id="mx_MjolnirUserSettingsTab_personalAdd"
type="text" type="text"
label={_t("Server or user ID to ignore")} label={_t("Server or user ID to ignore")}
placeholder={_t("eg: @bot:* or example.org")} placeholder={_t("eg: @bot:* or example.org")}
@ -305,7 +304,6 @@ export default class MjolnirUserSettingsTab extends React.Component {
<div> <div>
<form onSubmit={this._onSubscribeList} autoComplete="off"> <form onSubmit={this._onSubscribeList} autoComplete="off">
<Field <Field
id="mx_MjolnirUserSettingsTab_subscriptionAdd"
type="text" type="text"
label={_t("Room ID or alias of ban list")} label={_t("Room ID or alias of ban list")}
value={this.state.newList} value={this.state.newList}

View file

@ -195,19 +195,16 @@ export default class PreferencesUserSettingsTab extends React.Component {
{autoHideMenuOption} {autoHideMenuOption}
{autoLaunchOption} {autoLaunchOption}
<Field <Field
id={"autocompleteDelay"}
label={_t('Autocomplete delay (ms)')} label={_t('Autocomplete delay (ms)')}
type='number' type='number'
value={this.state.autocompleteDelay} value={this.state.autocompleteDelay}
onChange={this._onAutocompleteDelayChange} /> onChange={this._onAutocompleteDelayChange} />
<Field <Field
id={"readMarkerInViewThresholdMs"}
label={_t('Read Marker lifetime (ms)')} label={_t('Read Marker lifetime (ms)')}
type='number' type='number'
value={this.state.readMarkerInViewThresholdMs} value={this.state.readMarkerInViewThresholdMs}
onChange={this._onReadMarkerInViewThresholdMs} /> onChange={this._onReadMarkerInViewThresholdMs} />
<Field <Field
id={"readMarkerOutOfViewThresholdMs"}
label={_t('Read Marker off-screen lifetime (ms)')} label={_t('Read Marker off-screen lifetime (ms)')}
type='number' type='number'
value={this.state.readMarkerOutOfViewThresholdMs} value={this.state.readMarkerOutOfViewThresholdMs}

View file

@ -163,7 +163,7 @@ export default class VoiceUserSettingsTab extends React.Component {
if (audioOutputs.length > 0) { if (audioOutputs.length > 0) {
const defaultDevice = getDefaultDevice(audioOutputs); const defaultDevice = getDefaultDevice(audioOutputs);
speakerDropdown = ( speakerDropdown = (
<Field element="select" label={_t("Audio Output")} id="audioOutput" <Field element="select" label={_t("Audio Output")}
value={this.state.activeAudioOutput || defaultDevice} value={this.state.activeAudioOutput || defaultDevice}
onChange={this._setAudioOutput}> onChange={this._setAudioOutput}>
{this._renderDeviceOptions(audioOutputs, 'audioOutput')} {this._renderDeviceOptions(audioOutputs, 'audioOutput')}
@ -175,7 +175,7 @@ export default class VoiceUserSettingsTab extends React.Component {
if (audioInputs.length > 0) { if (audioInputs.length > 0) {
const defaultDevice = getDefaultDevice(audioInputs); const defaultDevice = getDefaultDevice(audioInputs);
microphoneDropdown = ( microphoneDropdown = (
<Field element="select" label={_t("Microphone")} id="audioInput" <Field element="select" label={_t("Microphone")}
value={this.state.activeAudioInput || defaultDevice} value={this.state.activeAudioInput || defaultDevice}
onChange={this._setAudioInput}> onChange={this._setAudioInput}>
{this._renderDeviceOptions(audioInputs, 'audioInput')} {this._renderDeviceOptions(audioInputs, 'audioInput')}
@ -187,7 +187,7 @@ export default class VoiceUserSettingsTab extends React.Component {
if (videoInputs.length > 0) { if (videoInputs.length > 0) {
const defaultDevice = getDefaultDevice(videoInputs); const defaultDevice = getDefaultDevice(videoInputs);
webcamDropdown = ( webcamDropdown = (
<Field element="select" label={_t("Camera")} id="videoInput" <Field element="select" label={_t("Camera")}
value={this.state.activeVideoInput || defaultDevice} value={this.state.activeVideoInput || defaultDevice}
onChange={this._setVideoInput}> onChange={this._setVideoInput}>
{this._renderDeviceOptions(videoInputs, 'videoInput')} {this._renderDeviceOptions(videoInputs, 'videoInput')}