Skip to content

Commit

Permalink
[BX-1431] ESC to dismiss Token Details fails (#1521)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Sinclair <[email protected]>
  • Loading branch information
derHowie and DanielSinclair committed May 11, 2024
1 parent 41970b6 commit fc32698
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/entries/popup/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ function NavbarButtonWithBack({
e.key === shortcuts.global.CLOSE.key &&
!radixIsActive() &&
(withinModal || !getActiveModal());
if (
closeWithEscape ||
(!getInputIsFocused() && e.key === shortcuts.global.BACK.key)
) {
const closeWithArrow =
!getInputIsFocused() && e.key === shortcuts.global.BACK.key;

if (closeWithEscape || closeWithArrow) {
trackShortcut({
key: closeWithEscape
? shortcuts.global.CLOSE.display
Expand Down
8 changes: 8 additions & 0 deletions src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@ export function TokenDetails() {
const navigate = useRainbowNavigate();
const token = userAsset || customAsset;

useEffect(() => {
const app = document.getElementById('app');
setTimeout(() => {
app?.focus();
}, 150);
}, []);

const { data: approvals } = useApprovals(
{
address: currentAddress,
Expand Down Expand Up @@ -583,6 +590,7 @@ export function TokenDetails() {
state: { skipTransitionOnRoute: ROUTES.HOME },
})
}
withinModal
/>
}
rightComponent={
Expand Down

0 comments on commit fc32698

Please sign in to comment.