From ce4d65a8d6a422212dd15e472b63b9d6fab32a54 Mon Sep 17 00:00:00 2001 From: gitstart Date: Fri, 16 Dec 2022 14:17:07 +0000 Subject: [PATCH] chore: reverts changes for new item focus --- .../RepeatableComponent/DraggedItem/index.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/core/admin/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js b/packages/core/admin/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js index ee554bf9ea..50d89e4f01 100644 --- a/packages/core/admin/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js +++ b/packages/core/admin/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js @@ -65,7 +65,6 @@ const DraggedItem = ({ }) => { const dragRef = useRef(null); const dropRef = useRef(null); - const contentRef = useRef(null); const [, forceRerenderAfterDnd] = useState(false); const { formatMessage } = useIntl(); @@ -159,17 +158,6 @@ const DraggedItem = ({ } }, [isDragging, setIsDraggingSibling]); - // Moves focus to the 1st focusable element in AccordionContent once new item added (mounted with isOpen=true) - useEffect(() => { - if (isOpen) { - const focusable = contentRef.current?.querySelector( - 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])' - ); - focusable?.focus(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - // Effect in order to force a rerender after reordering the components // Since we are removing the Accordion when doing the DnD we are losing the dragRef, therefore the replaced element cannot be dragged // anymore, this hack forces a rerender in order to apply the dragRef @@ -248,7 +236,7 @@ const DraggedItem = ({ togglePosition="left" /> - + {fields.map((fieldRow, key) => { return (