Files
redash/client/app/components/groups/CreateGroupDialog.jsx
Rafael Wendel 44178d9908 Improve input fields a11y (#5427)
* Added labels to params

* Added aria-label to inputs

* Linked unsemantic label with input

* Replaced span with label

* refactor: improve labels for schema browsers

* refactor: component accepts aria label

* refactor: add labels to sidebar search inputs
2021-03-26 11:45:24 -03:00

40 lines
965 B
JavaScript

import React from "react";
import Modal from "antd/lib/modal";
import Input from "antd/lib/input";
import { wrap as wrapDialog, DialogPropType } from "@/components/DialogWrapper";
class CreateGroupDialog extends React.Component {
static propTypes = {
dialog: DialogPropType.isRequired,
};
state = {
name: "",
};
save = () => {
this.props.dialog.close({
name: this.state.name,
});
};
render() {
const { dialog } = this.props;
return (
<Modal {...dialog.props} title="Create a New Group" okText="Create" onOk={() => this.save()}>
<Input
className="form-control"
defaultValue={this.state.name}
onChange={event => this.setState({ name: event.target.value })}
onPressEnter={() => this.save()}
placeholder="Group Name"
aria-label="Group name"
autoFocus
/>
</Modal>
);
}
}
export default wrapDialog(CreateGroupDialog);