-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #2885 - Focus ring getting stuck on last column of /accounts/budgeted #3571
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3b49d5e
Fixes focus ring getting stuck on last column of /accounts/budgeted s…
The-Firexx fa939a6
Fix lint problems with the previous commit
The-Firexx 149cc52
Merge branch 'master' into master
The-Firexx a6f46ad
Changed the way the hook is made to the cancel and add button, removi…
The-Firexx fe4f789
Merge branch 'master' of https://github.com/The-Firexx/actual
The-Firexx a63bd04
Merge branch 'master' of https://github.com/actualbudget/actual
The-Firexx 32b74b6
Changed the name of variables as mentioned in PR
The-Firexx a352a10
Merge branch 'master' of https://github.com/actualbudget/actual
The-Firexx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -49,6 +49,7 @@ import { | |||||
|
||||||
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'; | ||||||
|
@@ -1670,6 +1671,11 @@ function NewTransaction({ | |||||
); | ||||||
const emptyChildTransactions = childTransactions.filter(t => t.amount === 0); | ||||||
|
||||||
const addRef = useRef(null); | ||||||
useProperFocus(addRef, focusedField === 'add'); | ||||||
const cancelRef = useRef(null); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
useProperFocus(cancelRef, focusedField === 'cancel'); | ||||||
|
||||||
return ( | ||||||
<View | ||||||
style={{ | ||||||
|
@@ -1731,6 +1737,7 @@ function NewTransaction({ | |||||
style={{ marginRight: 10, padding: '4px 10px' }} | ||||||
onPress={() => onClose()} | ||||||
data-testid="cancel-button" | ||||||
ref={cancelRef} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
> | ||||||
Cancel | ||||||
</Button> | ||||||
|
@@ -1750,6 +1757,7 @@ function NewTransaction({ | |||||
style={{ padding: '4px 10px' }} | ||||||
onPress={onAdd} | ||||||
data-testid="add-button" | ||||||
ref={addRef} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
> | ||||||
Add | ||||||
</Button> | ||||||
|
@@ -2117,10 +2125,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 }); | ||||||
|
@@ -2185,8 +2197,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', | ||||||
|
@@ -2198,6 +2228,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( | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.