Skip to content

Commit 9cd61f2

Browse files
authored
fix(suite): Fix draggable window area on mac (#14175)
1 parent 652349b commit 9cd61f2

File tree

7 files changed

+19
-3
lines changed

7 files changed

+19
-3
lines changed

packages/components/src/components/buttons/Button/Button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type ButtonContainerProps = TransientProps<AllowedFrameProps> & {
4747
};
4848

4949
export const ButtonContainer = styled.button<ButtonContainerProps>`
50+
-webkit-app-region: no-drag;
5051
display: flex;
5152
align-items: center;
5253
justify-content: center;

packages/suite/src/components/suite/TrafficLightOffset.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22

33
import styled from 'styled-components';
44

5+
import { zIndices } from '@trezor/theme';
56
import { isDesktop, isMacOs } from '@trezor/env-utils';
67

78
type Props = {
@@ -11,15 +12,23 @@ type Props = {
1112
};
1213

1314
// See: https://github.com/electron/electron/issues/5678
14-
const FixForNotBeingAbleToDragWindow = styled.div`
15+
// Visible all the time in the app
16+
const ThinFixForNotBeingAbleToDragWindow = styled.div`
1517
-webkit-app-region: drag;
16-
height: 12px;
18+
height: 16px;
1719
position: fixed;
20+
z-index: ${zIndices.windowControls};
1821
top: 0;
1922
left: 0;
2023
width: 100%;
2124
`;
2225

26+
// Visible below content (but visible in the sidebar)
27+
const ThickFixForNotBeingAbleToDragWindow = styled(ThinFixForNotBeingAbleToDragWindow)`
28+
height: 64px;
29+
z-index: unset;
30+
`;
31+
2332
const Container = styled.div<{ $offset: number }>`
2433
${({ $offset }) => `padding-top: ${$offset}px;`}
2534
width: 100%;
@@ -35,7 +44,8 @@ export const TrafficLightOffset = ({ children, offset = 35, isVisible = true }:
3544

3645
return (
3746
<>
38-
<FixForNotBeingAbleToDragWindow />
47+
<ThinFixForNotBeingAbleToDragWindow />
48+
<ThickFixForNotBeingAbleToDragWindow />
3949
<Container $offset={offset}>{children}</Container>
4050
</>
4151
);

packages/suite/src/components/suite/banners/SuiteBanners/SuiteBanners.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const Container = styled.div<{ $isVisible?: boolean }>`
3434
display: flex;
3535
flex-direction: column;
3636
gap: ${spacingsPx.xs};
37+
position: relative; /* because it must be on the top of the draggable area on Mac */
3738
`;
3839

3940
export const SuiteBanners = () => {

packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceSelector.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const InnerContainer = styled.div`
5656
align-items: center;
5757
cursor: pointer;
5858
gap: ${spacingsPx.md};
59+
-webkit-app-region: no-drag;
5960
`;
6061

6162
export const DeviceSelector = () => {

packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/PageNames/AccountName/AccountDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const DetailsContainer = styled.div<{ $isBalanceShown: boolean; $shouldAnimate:
5252
animation: ${({ $isBalanceShown, $shouldAnimate }) =>
5353
getAnimation($isBalanceShown, $shouldAnimate)}
5454
0.3s forwards;
55+
-webkit-app-region: no-drag;
5556
`;
5657

5758
// eslint-disable-next-line local-rules/no-override-ds-component

packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/PageNames/BasicName.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Translation } from 'src/components/suite';
99
export const HeaderHeading = styled(H2)`
1010
display: flex;
1111
align-items: center;
12+
-webkit-app-region: no-drag;
1213
`;
1314

1415
export interface BasicNameProps {

packages/theme/src/zIndices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// modals should have `zIndex` in interval [1040; 1050).
33

44
export const zIndices = {
5+
windowControls: 100,
56
tooltip: 60, // above all content to be always fully visible when toggled
67
guide: 50, // above MODAL to stay accessible when modal is open
78
guideButton: 49, // below GUIDE to get covered by the guide when it is opening

0 commit comments

Comments
 (0)