mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-22 06:51:21 +02:00
Generate unique IDs for SettingsCheckbox
Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
parent
f44622b3d8
commit
b139c8d01c
@ -47,16 +47,16 @@ module.exports = React.createClass({
|
|||||||
if (!label) label = SettingsStore.getDisplayName(this.props.name, this.props.level);
|
if (!label) label = SettingsStore.getDisplayName(this.props.name, this.props.level);
|
||||||
else label = _t(label);
|
else label = _t(label);
|
||||||
|
|
||||||
let id = this.props.name;
|
// We generate a relatively complex ID to avoid conflicts
|
||||||
|
const id = this.props.name + "_" + this.props.group + "_" + this.props.value + "_" + this.props.level;
|
||||||
let checkbox = (
|
let checkbox = (
|
||||||
<input id={this.props.name}
|
<input id={id}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
defaultChecked={val}
|
defaultChecked={val}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
if (this.props.group) {
|
if (this.props.group) {
|
||||||
id = this.props.group + '_' + this.props.name;
|
|
||||||
checkbox = (
|
checkbox = (
|
||||||
<input id={id}
|
<input id={id}
|
||||||
type="radio"
|
type="radio"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user