The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Scroll to currently softfocus cell (#1008)
brendanlaschke700b567320ea
diff --git a/front/src/modules/ui/table/editable-cell/components/EditableCellContainer.tsx b/front/src/modules/ui/table/editable-cell/components/EditableCellContainer.tsxindex 89605378898..44db13684b4 100644--- a/front/src/modules/ui/table/editable-cell/components/EditableCellContainer.tsx+++ b/front/src/modules/ui/table/editable-cell/components/EditableCellContainer.tsx@@ -1,8 +1,10 @@+import { Ref } from 'react';import styled from '@emotion/styled';type Props = {softFocus?: boolean;onClick?: () => void;+ scrollRef?: Ref<HTMLDivElement>;};export const EditableCellDisplayModeOuterContainer = styled.div<@@ -37,6 +39,7 @@ export function EditableCellDisplayContainer({children,softFocus,onClick,+ scrollRef,}: React.PropsWithChildren<Props>) {return (<EditableCellDisplayModeOuterContainer@@ -47,6 +50,7 @@ export function EditableCellDisplayContainer({}onClick={onClick}softFocus={softFocus}+ ref={scrollRef}><EditableCellDisplayModeInnerContainer>{children}diff --git a/front/src/modules/ui/table/editable-cell/components/EditableCellSoftFocusMode.tsx b/front/src/modules/ui/table/editable-cell/components/EditableCellSoftFocusMode.tsxindex bfac7d87236..03da95fbb28 100644--- a/front/src/modules/ui/table/editable-cell/components/EditableCellSoftFocusMode.tsx+++ b/front/src/modules/ui/table/editable-cell/components/EditableCellSoftFocusMode.tsx@@ -1,4 +1,4 @@-import { PropsWithChildren } from 'react';+import { PropsWithChildren, useEffect, useRef } from 'react';import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';@@ -13,6 +13,12 @@ type OwnProps = PropsWithChildren<unknown>;export function EditableCellSoftFocusMode({ children }: OwnProps) {const { openEditableCell } = useEditableCell();+ const scrollRef = useRef<HTMLDivElement>(null);++ useEffect(() => {+ scrollRef.current?.scrollIntoView({ block: 'nearest' });+ });+function openEditMode() {openEditableCell();}@@ -52,7 +58,11 @@ export function EditableCellSoftFocusMode({ children }: OwnProps) {}return (- <EditableCellDisplayContainer onClick={handleClick} softFocus>+ <EditableCellDisplayContainer+ onClick={handleClick}+ softFocus+ scrollRef={scrollRef}+ >{children}</EditableCellDisplayContainer>);