Skip to content
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

[BX-1431] ESC to dismiss Token Details fails #1521

Merged
merged 6 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this was as last resource?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of. This issue exists throughout the app, but I placed a hook inside AnimatedRoute to handle it.

This screen is not using animated route, so I had to put it in manually.


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