Skip to content

Commit

Permalink
Fix panels issues (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbeno authored Nov 25, 2024
1 parent be15453 commit fb0159d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit fb0159d

Please sign in to comment.