Skip to content

Commit d7b5228

Browse files
authored
Merge pull request #1699 from Northeastern-Electric-Racing/#1659-tab-through-products
#1659 visual indication when tabbing through delete and add
2 parents 773926b + 693fe9d commit d7b5228

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { OtherProductReason, WbsNumber, validateWBS, wbsPipe, ReimbursementProdu
2525
import { Add, Delete } from '@mui/icons-material';
2626
import { Control, Controller, FieldErrors, UseFormSetValue } from 'react-hook-form';
2727
import { ReimbursementRequestFormInput } from './ReimbursementRequestForm';
28+
import { useTheme } from '@mui/system';
2829

2930
const otherCategoryOptions = [
3031
{ label: 'Competition', id: 'COMPETITION' },
@@ -83,6 +84,9 @@ const ReimbursementProductTable: React.FC<ReimbursementProductTableProps> = ({
8384
setValue(`reimbursementProducts.${index}.cost`, parseFloat(value.toFixed(2)));
8485
};
8586

87+
const userTheme = useTheme();
88+
const hoverColor = userTheme.palette.action.hover;
89+
8690
return (
8791
<TableContainer>
8892
<Table>
@@ -155,23 +159,39 @@ const ReimbursementProductTable: React.FC<ReimbursementProductTableProps> = ({
155159
{errors.reimbursementProducts?.[product.index]?.cost?.message}
156160
</FormHelperText>
157161
</FormControl>
158-
<IconButton onClick={() => removeProduct(product.index)}>
162+
<IconButton
163+
sx={{
164+
'&:focus': {
165+
backgroundColor: hoverColor
166+
}
167+
}}
168+
onClick={() => removeProduct(product.index)}
169+
>
159170
<Delete />
160171
</IconButton>
161172
</Box>
162173
</ListItem>
163174
))}
164175
</Box>
165176
<Button
166-
sx={{ margin: '4px' }}
177+
sx={{
178+
margin: '4px',
179+
'&:focus': {
180+
backgroundColor: hoverColor
181+
},
182+
'&:hover': {
183+
backgroundColor: hoverColor
184+
}
185+
}}
167186
startIcon={<Add />}
168-
onClick={() =>
187+
onClick={(e) => {
169188
appendProduct({
170189
reason: key.includes('.') ? validateWBS(key) : (key as OtherProductReason),
171190
name: '',
172191
cost: 0
173-
})
174-
}
192+
});
193+
e.currentTarget.blur();
194+
}}
175195
>
176196
Add Product
177197
</Button>

0 commit comments

Comments
 (0)