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

[bug] Provider affects the DOM #2164

Open
1 task done
LufyCZ opened this issue Aug 28, 2024 · 3 comments
Open
1 task done

[bug] Provider affects the DOM #2164

LufyCZ opened this issue Aug 28, 2024 · 3 comments

Comments

@LufyCZ
Copy link

LufyCZ commented Aug 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

2.1.5

wagmi Version

2.17.0

Current Behavior

The RainbowKitProvider component injects a <div> which affects styling.

image

The above should result in a fully red screen, however, the "injected" div doesn't have a h-full, and thus the div below won't stretch to the height of the screen.

image

The div in question

Expected Behavior

The provider should not affect the DOM in a way that potentially breaks styling.

Steps To Reproduce

No response

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

https://github.com/LufyCZ/rainbowkit-bug

Anything else?

No response

@LufyCZ LufyCZ changed the title [bug] Provider affects the DOM, [bug] Provider affects the DOM Aug 28, 2024
@Adebesin-Cell
Copy link

You can try.

function MyApp() {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={client}>
        <RainbowKitProvider>
          <div style={{ height: "100vh" }}>
            <div style={{ height: "100%", background: "red" }}>
              <p>lorem ipsum</p>
            </div>
          </div>
        </RainbowKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
}

@LufyCZ
Copy link
Author

LufyCZ commented Sep 11, 2024

You can try.

function MyApp() {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={client}>
        <RainbowKitProvider>
          <div style={{ height: "100vh" }}>
            <div style={{ height: "100%", background: "red" }}>
              <p>lorem ipsum</p>
            </div>
          </div>
        </RainbowKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
}

I solved it with [&>*]:h-full on the div right above the RainbowKitProvider.

However, what you are proposing is still not a "correct" solution. The provider could be used somewhere further down the tree, and, for example, if there was a Header above it, the page would then be px(Header) + 100vh high (which is more than 100vh).

@Adebesin-Cell
Copy link

You can try.

function MyApp() {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={client}>
        <RainbowKitProvider>
          <div style={{ height: "100vh" }}>
            <div style={{ height: "100%", background: "red" }}>
              <p>lorem ipsum</p>
            </div>
          </div>
        </RainbowKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
}

I solved it with [&>*]:h-full on the div right above the RainbowKitProvider.

However, what you are proposing is still not a "correct" solution. The provider could be used somewhere further down the tree, and, for example, if there was a Header above it, the page would then be px(Header) + 100vh high (which is more than 100vh).

Yeah, good point! Though I did add a fix to clone the child element and add the props to it, got closed haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants