mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-29 18:19:44 -05:00
* Fixes focus ring getting stuck on last column of /accounts/budgeted screen when creating a new transaction. * Fix lint problems with the previous commit * Changed the way the hook is made to the cancel and add button, removing the need to change Button2 * Changed the name of variables as mentioned in PR
This commit is contained in:
@@ -51,6 +51,7 @@ import {
|
||||
import { useFeatureFlag } from '../../hooks/useFeatureFlag';
|
||||
import { useMergedRefs } from '../../hooks/useMergedRefs';
|
||||
import { usePrevious } from '../../hooks/usePrevious';
|
||||
import { useProperFocus } from '../../hooks/useProperFocus';
|
||||
import { useSelectedDispatch, useSelectedItems } from '../../hooks/useSelected';
|
||||
import { useSplitsExpanded } from '../../hooks/useSplitsExpanded';
|
||||
import { SvgLeftArrow2, SvgRightArrow2, SvgSplit } from '../../icons/v0';
|
||||
@@ -1725,6 +1726,11 @@ function NewTransaction({
|
||||
);
|
||||
const emptyChildTransactions = childTransactions.filter(t => t.amount === 0);
|
||||
|
||||
const addButtonRef = useRef(null);
|
||||
useProperFocus(addButtonRef, focusedField === 'add');
|
||||
const cancelButtonRef = useRef(null);
|
||||
useProperFocus(cancelButtonRef, focusedField === 'cancel');
|
||||
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
@@ -1786,6 +1792,7 @@ function NewTransaction({
|
||||
style={{ marginRight: 10, padding: '4px 10px' }}
|
||||
onPress={() => onClose()}
|
||||
data-testid="cancel-button"
|
||||
ref={cancelButtonRef}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
@@ -1805,6 +1812,7 @@ function NewTransaction({
|
||||
style={{ padding: '4px 10px' }}
|
||||
onPress={onAdd}
|
||||
data-testid="add-button"
|
||||
ref={addButtonRef}
|
||||
>
|
||||
Add
|
||||
</Button>
|
||||
@@ -2178,10 +2186,14 @@ export const TransactionTable = forwardRef((props, ref) => {
|
||||
}
|
||||
}, [prevSplitsExpanded.current]);
|
||||
|
||||
const newNavigator = useTableNavigator(newTransactions, getFields);
|
||||
const newNavigator = useTableNavigator(
|
||||
newTransactions,
|
||||
getFieldsNewTransaction,
|
||||
);
|
||||
|
||||
const tableNavigator = useTableNavigator(
|
||||
transactionsWithExpandedSplits,
|
||||
getFields,
|
||||
getFieldsTableTransaction,
|
||||
);
|
||||
const shouldAdd = useRef(false);
|
||||
const latestState = useRef({ newTransactions, newNavigator, tableNavigator });
|
||||
@@ -2246,8 +2258,26 @@ export const TransactionTable = forwardRef((props, ref) => {
|
||||
savePending.current = false;
|
||||
}, [newTransactions, props.transactions]);
|
||||
|
||||
function getFields(item) {
|
||||
let fields = [
|
||||
function getFieldsNewTransaction(item) {
|
||||
const fields = [
|
||||
'select',
|
||||
'date',
|
||||
'account',
|
||||
'payee',
|
||||
'notes',
|
||||
'category',
|
||||
'debit',
|
||||
'credit',
|
||||
'cleared',
|
||||
'cancel',
|
||||
'add',
|
||||
];
|
||||
|
||||
return getFields(item, fields);
|
||||
}
|
||||
|
||||
function getFieldsTableTransaction(item) {
|
||||
const fields = [
|
||||
'select',
|
||||
'date',
|
||||
'account',
|
||||
@@ -2259,6 +2289,10 @@ export const TransactionTable = forwardRef((props, ref) => {
|
||||
'cleared',
|
||||
];
|
||||
|
||||
return getFields(item, fields);
|
||||
}
|
||||
|
||||
function getFields(item, fields) {
|
||||
fields = item.is_child
|
||||
? ['select', 'payee', 'notes', 'category', 'debit', 'credit']
|
||||
: fields.filter(
|
||||
|
||||
6
upcoming-release-notes/3571.md
Normal file
6
upcoming-release-notes/3571.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [The-Firexx]
|
||||
---
|
||||
|
||||
Fixes focus ring getting "stuck" on last column of /accounts/budgeted screen when creating a new transaction.
|
||||
Reference in New Issue
Block a user