diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e70c2c35..4c491cea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Updated portuguese translations - Fix a bug: wrong variable reference in `SingleSignOnConcern:Merge_form_sso` +- Fix a bug: wrong focus behavior on text editor ## v5.4.15 2022 August 1 diff --git a/app/frontend/src/javascript/components/form/abstract-form-item.tsx b/app/frontend/src/javascript/components/form/abstract-form-item.tsx index 679c2bde9..afa91a07a 100644 --- a/app/frontend/src/javascript/components/form/abstract-form-item.tsx +++ b/app/frontend/src/javascript/components/form/abstract-form-item.tsx @@ -9,15 +9,16 @@ export interface AbstractFormItemProps extends PropsWithChildren boolean), - onLabelClick?: (event: React.MouseEvent) => void, + onLabelClick?: (event: React.MouseEvent) => void, inLine?: boolean, + containerType?: 'label' | 'div' } /** * This abstract component should not be used directly. * Other forms components that are intended to be used with react-hook-form must extend this component. */ -export const AbstractFormItem = ({ id, label, tooltip, className, disabled, error, warning, rules, formState, onLabelClick, inLine, children }: AbstractFormItemProps) => { +export const AbstractFormItem = ({ id, label, tooltip, className, disabled, error, warning, rules, formState, onLabelClick, inLine, containerType, children }: AbstractFormItemProps) => { const [isDirty, setIsDirty] = useState(false); const [fieldError, setFieldError] = useState<{ message: string }>(error); const [isDisabled, setIsDisabled] = useState(false); @@ -52,16 +53,16 @@ export const AbstractFormItem = ({ id, label, * This function is called when the label is clicked. * It is used to focus the input. */ - function handleLabelClick (event: React.MouseEvent) { + function handleLabelClick (event: React.MouseEvent) { if (typeof onLabelClick === 'function') { onLabelClick(event); } } - return ( -