MUI Right sidebar conflicts with Left sidebar

I have Header with Toolbar. Clicking on left icon it will open Left sidebar like so
enter image description here

But if I open the right sidebar, when I open it, it shifts the icons on the left under the left open sidebar, but this shouldn’t happen, the icons should stay in place
And the second problem is that when I open the right sidebar the content inside the page is not narrowed on the right side.
enter image description here

How it should like
enter image description here

import { FC } from 'react';
import { styled, Theme, CSSObject } from '@mui/material/styles';
import MuiDrawer from '@mui/material/Drawer';

const drawerWidth = 256;

const openedMixin = (theme: Theme): CSSObject => ({
    width: drawerWidth,
    transition: theme.transitions.create('width', {
        easing: theme.transitions.easing.sharp,
        duration: theme.transitions.duration.enteringScreen,
    }),
    overflowX: 'hidden',
});

const closedMixin = (theme: Theme): CSSObject => ({
    transition: theme.transitions.create('width', {
        easing: theme.transitions.easing.sharp,
        duration: theme.transitions.duration.leavingScreen,
    }),
    overflowX: 'hidden',
    width: 0,
    [theme.breakpoints.up('sm')]: {
        width: 0,
    },
});

const Drawer = styled(MuiDrawer, {
    shouldForwardProp: (prop) => prop !== 'open',
})(({ theme, open }) => ({
    width: drawerWidth,
    flexShrink: 0,
    whiteSpace: 'nowrap',
    boxSizing: 'border-box',
    position: 'absolute',
    right: 0,
    top: 0,
    ...(open && {
        ...openedMixin(theme),
        '& .MuiDrawer-paper': openedMixin(theme),
    }),
    ...(!open && {
        ...closedMixin(theme),
        '& .MuiDrawer-paper': closedMixin(theme),
    }),
}));

interface RightSidebarProps {
    open: boolean;
}

export const RightSidebar: FC<RightSidebarProps> = ({ open }) => {
    return (
        <Drawer variant="permanent" anchor="right" open={open}>
            <div>Right sidebar</div>
        </Drawer>
    );
};

Header with sidebars

const drawerWidth = 256;

const closedMixin = (theme: Theme): CSSObject => ({
    transition: theme.transitions.create('width', {
        easing: theme.transitions.easing.sharp,
        duration: theme.transitions.duration.leavingScreen,
    }),
    overflowX: 'hidden',
    width: `calc(${theme.spacing(7)} + 1px)`,
    [theme.breakpoints.up('sm')]: {
        width: `calc(${theme.spacing(8)} + 1px)`,
    },
});

const DrawerHeader = styled('div')(({ theme }) => ({
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'flex-end',
    padding: theme.spacing(0, 1),
    ...theme.mixins.toolbar,
}));

const AppBar = styled(MuiAppBar, {
    shouldForwardProp: (prop) => prop !== 'openLeft' && prop !== 'openRight',
})<AppBarProps>(({ theme, openLeft, openRight }) => {
    const { isMedium } = useBreakpointsContext();
    return {
        transition: theme.transitions.create(['margin', 'width'], {
            easing: theme.transitions.easing.sharp,
            duration: theme.transitions.duration.leavingScreen,
        }),
        ...(openLeft &&
            !isMedium && {
                width: `calc(100% - ${drawerWidth}px)`,
                marginLeft: `${drawerWidth}px`,
                transition: theme.transitions.create(['margin', 'width'], {
                    easing: theme.transitions.easing.easeOut,
                    duration: theme.transitions.duration.enteringScreen,
                }),
            }),
        ...(!openLeft &&
            !isMedium && {
                width: `calc(100% - ${closedMixin(theme).width})`,
                marginLeft: `${closedMixin(theme).width}`,
            }),
        ...(openRight && {
            width: `calc(100% - ${drawerWidth}px)`,
            marginRight: `${drawerWidth}px`,
            transition: theme.transitions.create(['margin', 'width'], {
                easing: theme.transitions.easing.easeOut,
                duration: theme.transitions.duration.enteringScreen,
            }),
        }),
    };
});

<Box sx={{ display: 'flex' }}>
            <CssBaseline />
            <AppBar
                position="absolute"
                openLeft={openLeftSidebar}
                openRight={openRightSidebar}
                color="transparent"
                elevation={0}
                sx={{
                    borderBottom: 1,
                    borderColor: isDarkMode
                        ? 'rgba(255, 255, 255, 0.12)'
                        : '#E0E0E0',
                    display: 'flex',
                    flexDirection: 'row',
                    justifyContent: 'space-between',
                }}
            >
                <Toolbar disableGutters sx={{ padding: '12px 31px' }}>
                    {!isMedium && (
                        <IconButton
                            color="inherit"
                            aria-label="open drawer"
                            onClick={toggleLeftSidebar}
                            edge="start"
                            disableRipple
                            sx={{
                                transform: 'rotate(180deg)',
                                marginRight: '8px',
                            }}
                        >
                            <ViewSidebarIcon />
                        </IconButton>
                    )}
                    {!isMedium && (
                        <Box>
                            <IconButton
                                disableRipple
                                onClick={handleBack}
                                disabled={currentIndex <= 0}
                            >
                                <ChevronLeftIcon
                                    color="primary"
                                    sx={{ width: 20, height: 20 }}
                                />
                            </IconButton>
                            <IconButton
                                color="primary"
                                disableRipple
                                onClick={handleForward}
                                disabled={currentIndex >= history.length - 1}
                            >
                                <ChevronRightIcon
                                    sx={{ width: 20, height: 20 }}
                                />
                            </IconButton>
                        </Box>
                    )}
                    <BreadcrumbsMUI onMoveToPage={onMoveToPage} />
                </Toolbar>
                {isSmall && location.pathname === onboardingPath && pageTitle}
                <Toolbar>
                    {isTablet && location.pathname === walletPath && pageTitle}
                    <IconButton
                        color="inherit"
                        disableRipple
                        onClick={toggleTheme}
                    >
                        {isDarkMode ? (
                            <LightModeOutlinedIcon />
                        ) : (
                            <DarkModeOutlinedIcon />
                        )}
                    </IconButton>
                    <IconButton onClick={handleHelpDialogOpen} disableRipple>
                        <HelpOutlineIcon
                            sx={{ width: 24, height: 24 }}
                            color="primary"
                        />
                    </IconButton>
                    {location.pathname !== onboardingPath && (
                        <IconButton color="inherit" disableRipple onClick={toggleRightSidebar}>
                            <Badge>
                                <NotificationsOutlinedIcon />
                            </Badge>
                        </IconButton>
                    )}
                </Toolbar>
            </AppBar>
            {!isMedium && (
                <LeftSidebar
                    open={openLeftSidebar}
                    openAccount={openAccount}
                    handleAccountClick={handleAccountClick}
                    onMoveToPage={onMoveToPage}
                    userData={userData}
                    dealsCount={dealsCount}
                    avatarImg={avatarImg}
                />
            )}
            {isMedium && (
                <BottomNav
                    onMoveToPage={onMoveToPage}
                    onboardingComplete={userData?.onboarding_complete}
                />
            )}
            <RightSidebar open={openRightSidebar} />
            <Box
                component="main"
                sx={{
                    width: '100%',
                }}
            >
                <DrawerHeader />
                <Snackbar open={!userData?.allowed_operations}>
                    <Alert
                        severity="warning"
                        variant="filled"
                        sx={{ width: '100%' }}
                    >
                        Your account is being reviewed for approval. If
                        approved, you will gain access to further details and
                        the ability to make an investment.
                    </Alert>
                </Snackbar>
                <Box sx={{ flexGrow: 1, padding: isMedium ? '24px' : '32px' }}>
                    {children}
                </Box>
            </Box>
            <HelpDialog open={helpDialogOpen} onClose={handleHelpDialogClose} />
        </Box>

I think it could because of the wrong margin calculation. To solve second problem I can just simply add margin when right sidebar is open, not sure it’s the best solution

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật