mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 19:48:50 +03:00
Added id and aria-label values for input field component
no issue - Adds `aria-label` on input fields and id for label's `for` to map to form control - Fixes tests
This commit is contained in:
parent
c53654d89b
commit
eb4ed70303
@ -27,18 +27,21 @@ const Styles = ({style = {}}) => {
|
||||
};
|
||||
};
|
||||
|
||||
function InputField({name, label, type, value, placeholder, onChange, style}) {
|
||||
function InputField({name, id, label, type, value, placeholder, onChange, style}) {
|
||||
const Style = Styles({style});
|
||||
id = id || `input-${name}`;
|
||||
return (
|
||||
<>
|
||||
<label htmlFor={name} style={Style.label}> {label} </label>
|
||||
<label htmlFor={id} style={Style.label}> {label} </label>
|
||||
<input
|
||||
id={id}
|
||||
type={type}
|
||||
name={name}
|
||||
placeholder={placeholder}
|
||||
value={value}
|
||||
onChange={e => onChange(e, name)}
|
||||
style={Style.input}
|
||||
aria-label={label}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user