Fix field widget textarea focus reset (#21959)
Short description: Keeps the field widget textarea on a local draft value while focused so record-store rewrites do not reset the active caret. # Before Typing in an editor-mode text field can lose caret position when the global record store is rewritten by an external record update/refetch. https://github.com/user-attachments/assets/1ee7a819-2c27-4d09-aae5-814c2cf27181 # After The focused textarea should preserve the in-progress draft and caret while still updating sibling previews optimistically and flushing the final value on blur. https://github.com/user-attachments/assets/41832493-021f-46e8-bc75-722bbb1cd7b7 <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21959?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
committed by
GitHub
parent
b1ada79d72
commit
6ce7d04f9d
@@ -22,6 +22,7 @@ export type TextAreaProps = {
|
||||
placeholder?: string;
|
||||
value?: string;
|
||||
className?: string;
|
||||
onFocus?: () => void;
|
||||
onBlur?: () => void;
|
||||
readOnly?: boolean;
|
||||
variant?: TextAreaVariant;
|
||||
@@ -102,6 +103,7 @@ export const TextArea = ({
|
||||
value = '',
|
||||
className,
|
||||
onChange,
|
||||
onFocus,
|
||||
onBlur,
|
||||
readOnly = false,
|
||||
variant = 'default',
|
||||
@@ -127,6 +129,8 @@ export const TextArea = ({
|
||||
enableGlobalHotkeysConflictingWithKeyboard: false,
|
||||
},
|
||||
});
|
||||
|
||||
onFocus?.();
|
||||
};
|
||||
|
||||
const handleBlur: FocusEventHandler<HTMLTextAreaElement> = () => {
|
||||
|
||||
Reference in New Issue
Block a user