mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 17:47:00 -05:00
fix(web): Close popover on Escape press (#6570)
* fix(web): Close popover on second Escape press when autocomplete options are closed * [autofix.ci] apply automated fixes * fix(web): use more accurate approach with isOpen --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -562,7 +562,7 @@ function SingleAutocomplete<T extends AutocompleteItem>({
|
||||
if (e.key === 'Escape') {
|
||||
e.nativeEvent['preventDownshiftDefault'] = true;
|
||||
|
||||
if (!embedded) {
|
||||
if (!embedded && isOpen) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
|
||||
@@ -928,18 +928,12 @@ describe('Transactions', () => {
|
||||
let input = expectToBeEditingField(container, 'date', 0, true);
|
||||
await userEvent.type(input, '[Tab]');
|
||||
input = expectToBeEditingField(container, 'account', 0, true);
|
||||
// The first escape closes the dropdown
|
||||
|
||||
await userEvent.type(input, '[Escape]');
|
||||
await userEvent.type(input, '[Escape]');
|
||||
expect(
|
||||
container.querySelector('[data-testid="new-transaction"]'),
|
||||
).toBeTruthy();
|
||||
|
||||
// TODO: Fix this
|
||||
// Now it should close the new transaction form
|
||||
// await userEvent.type(input, '[Escape]');
|
||||
// expect(
|
||||
// container.querySelector('[data-testid="new-transaction"]')
|
||||
// ).toBeNull();
|
||||
).toBeNull();
|
||||
|
||||
// The cancel button should also close the new transaction form
|
||||
updateProps({ isAdding: true });
|
||||
|
||||
6
upcoming-release-notes/6570.md
Normal file
6
upcoming-release-notes/6570.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [skliaruk]
|
||||
---
|
||||
|
||||
Closes the popover on second Escape press once autocomplete options are closed.
|
||||
Reference in New Issue
Block a user