From 610dc7831e2b1da75c07a9b6466b5e5f97b8c155 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Fri, 8 Sep 2023 15:18:19 -0700 Subject: [PATCH] Check disabled --- .../transactions/MobileTransaction.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/desktop-client/src/components/transactions/MobileTransaction.js b/packages/desktop-client/src/components/transactions/MobileTransaction.js index 10fa28394a4..64d06f99f94 100644 --- a/packages/desktop-client/src/components/transactions/MobileTransaction.js +++ b/packages/desktop-client/src/components/transactions/MobileTransaction.js @@ -361,6 +361,8 @@ class TransactionEditInner extends PureComponent { padding: '7px 7px', }; + const disableCategoryField = account?.offbudget || transferAcct; + return ( // this.onEdit(transaction, 'payee', payeeId)} onSelect={payeeId => { this.onEdit(transaction, 'payee', payeeId); - // Go to next. - this.categoryInputRef.current?.focus(); + if (!this.categoryInputRef.current?.disabled) { + // Go to next. + this.categoryInputRef.current?.focus(); + } }} // onManagePayees={() => onManagePayees(payeeId)} isCreatable @@ -576,9 +580,9 @@ class TransactionEditInner extends PureComponent { showSplitOption={false} // {!transaction.is_child && !transaction.is_parent} inputProps={{ inputRef: this.categoryInputRef, - disabled: account?.offbudget || transferAcct, + disabled: disableCategoryField, style: { - ...((account?.offbudget || transferAcct) && { + ...(disableCategoryField && { backgroundColor: theme.formInputTextReadOnlySelection, }), height: 40, @@ -593,8 +597,10 @@ class TransactionEditInner extends PureComponent { } onSelect={categoryId => { this.onEdit(transaction, 'category', categoryId); - // Go to next. - this.accountInputRef.current?.focus(); + if (!this.accountInputRef.current?.disabled) { + // Go to next. + this.accountInputRef.current?.focus(); + } }} menuPortalTarget={undefined} />