最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

toasify's toast appears behind radix-themes' dialog - Stack Overflow

programmeradmin9浏览0评论
  • version of library "@radix-ui/themes": "^3.1.6" "react-toastify": "^11.0.3"

  • if radix-themes dialog is open(dialog.content), toast is appears after dialog. so toast is unclickable,,, what am i wrong for this code?

  • App.tsx

function App() {
  return (
    <>
      <Theme
        accentColor="cyan"
        grayColor="slate"
        panelBackground="solid"
        scaling="100%"
        radius="small"
      >
        <QueryClientProvider client={myQueryClient}>
          <CookiesProvider>
            <Provider>
              <RouterProvider router={router} />
              <ReactQueryDevtools />
            </Provider>
          </CookiesProvider>
        </QueryClientProvider>
      </Theme>
      <ToastContainer
      position="bottom-right"
      autoClose={5000}
      newestOnTop={false}
      closeOnClick
      rtl={false}
      pauseOnFocusLoss
      draggable
      pauseOnHover
      theme="colored"
      limit={3}
      toastStyle={{
        fontFamily: "Pretendard",
        fontWeight: "normal",
        fontSize: 14,
      }}
    />
    </>
  );
}
  • case ( toastify's toast is unclickable )

i Tried change toast Container z-index to high number but it doesn't work. Does it have anything to do with the dialog's portal?

  • version of library "@radix-ui/themes": "^3.1.6" "react-toastify": "^11.0.3"

  • if radix-themes dialog is open(dialog.content), toast is appears after dialog. so toast is unclickable,,, what am i wrong for this code?

  • App.tsx

function App() {
  return (
    <>
      <Theme
        accentColor="cyan"
        grayColor="slate"
        panelBackground="solid"
        scaling="100%"
        radius="small"
      >
        <QueryClientProvider client={myQueryClient}>
          <CookiesProvider>
            <Provider>
              <RouterProvider router={router} />
              <ReactQueryDevtools />
            </Provider>
          </CookiesProvider>
        </QueryClientProvider>
      </Theme>
      <ToastContainer
      position="bottom-right"
      autoClose={5000}
      newestOnTop={false}
      closeOnClick
      rtl={false}
      pauseOnFocusLoss
      draggable
      pauseOnHover
      theme="colored"
      limit={3}
      toastStyle={{
        fontFamily: "Pretendard",
        fontWeight: "normal",
        fontSize: 14,
      }}
    />
    </>
  );
}
  • case ( toastify's toast is unclickable )

i Tried change toast Container z-index to high number but it doesn't work. Does it have anything to do with the dialog's portal?

Share Improve this question asked Mar 13 at 4:49 Jay BeemoJay Beemo 11
Add a comment  | 

1 Answer 1

Reset to default 0

z-index only works within the same stacking context. Your ToastContainer is outside the dialog's stacking context, its z-index won't have any effect on the dialog's content.
The simplest solution is to move the <ToastContainer> component inside the <Theme> component.

function App() {
  return (
    <Theme
      accentColor="cyan"
      grayColor="slate"
      panelBackground="solid"
      scaling="100%"
      radius="small"
    >
      <QueryClientProvider client={myQueryClient}>
        <CookiesProvider>
          <Provider>
            <RouterProvider router={router} />
            <ReactQueryDevtools />
            <ToastContainer
              position="bottom-right"
              autoClose={5000}
              newestOnTop={false}
              closeOnClick
              rtl={false}
              pauseOnFocusLoss
              draggable
              pauseOnHover
              theme="colored"
              limit={3}
              toastStyle={{
                fontFamily: "Pretendard",
                fontWeight: "normal",
                fontSize: 14,
              }}
            />
          </Provider>
        </CookiesProvider>
      </QueryClientProvider>
    </Theme>
  );
}
发布评论

评论列表(0)

  1. 暂无评论