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

Fix panels issues #693

Merged
merged 1 commit into from
Nov 25, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion shared/features/amount-selector/amount-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export function AmountSelector({
onChange={handleChangeAmount}
readOnly={readOnly}
placeholder={"_"}
autoFocus={!readOnly}
// COMMENT THIS BECAUSE IT CAUSES A TRANSLATE ERROR ON DRAWERS
// autoFocus={!readOnly}
/>
<div onClick={handleFocusInput}>
<span
Expand Down
2 changes: 1 addition & 1 deletion shared/features/side-panels/side-panel/side-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const SidePanel = forwardRef(function SidePanel<T extends AnyType>(
>
<Paper
border={"none"}
background={"transparent"}
background={"primary"}
py={"none"}
px={"none"}
classNames={{
Expand Down
6 changes: 6 additions & 0 deletions shared/features/side-panels/side-panels.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ export function SidePanelsProvider({ children, classNames }: SidePanelsContextPr
});
}

function safeBlur() {
(document?.activeElement as HTMLElement)?.blur?.();
}

function closePanel(name?: string) {
safeBlur();
if (name) {
setOpenedPanels(openedPanels.filter(panel => panel !== name));
setData(data.filter(([panel]) => panel !== name));
Expand All @@ -75,6 +80,7 @@ export function SidePanelsProvider({ children, classNames }: SidePanelsContextPr
}

function onBack() {
safeBlur();
if (openedPanels.length === 1) {
setOpenedPanels([]);
setData([]);
Expand Down