File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,14 @@ const Index = () => {
320320 const handleEditTransaction = ( transaction : Transaction ) => {
321321 setEditingTransaction ( transaction ) ;
322322 setShowTransactionForm ( true ) ;
323+
324+ // Scroll to the form if it's already visible, otherwise wait for it to render
325+ setTimeout ( ( ) => {
326+ const formElement = document . getElementById ( 'transaction-form' ) ;
327+ if ( formElement ) {
328+ formElement . scrollIntoView ( { behavior : 'smooth' , block : 'center' } ) ;
329+ }
330+ } , 100 ) ;
323331 } ;
324332
325333 const expenses = transactions . filter ( transaction => transaction . type === 'expense' ) ;
@@ -439,7 +447,7 @@ const Index = () => {
439447 </ Button >
440448 </ div >
441449 </ CardHeader >
442- < CardContent className = "pt-6 px-6" >
450+ < CardContent className = "pt-6 px-6" id = "transaction-form" >
443451 < TransactionForm
444452 onSubmit = { addTransaction }
445453 onCancel = { ( ) => {
You can’t perform that action at this time.
0 commit comments