web3modal icon indicating copy to clipboard operation
web3modal copied to clipboard

How to override z-index of modal?

Open 0xTimepunk opened this issue 4 years ago • 12 comments

I am using react-financial-charts (https://github.com/reactivemarkets/react-financial-charts) and the following happens:

image

I cannot select the wallets where the chart is being drawn (some elements appear even in front of the web3modal). Do you think I can solve this by overriding the z-index? If so what is the appropriate css class to override? Thank you

0xTimepunk avatar Jun 04 '20 16:06 0xTimepunk

The parent element of the modal is identified by WEB3_CONNECT_MODAL_ID have you attempted to increase the z-index to be higher than the ones used by react-financial-charts??

pedrouid avatar Jun 04 '20 16:06 pedrouid

@pedrouid I was doing it like this, but I can try to manually override that element image

0xTimepunk avatar Jun 04 '20 16:06 0xTimepunk

Interesting, that could be useful. Theme is used for colors only... I will leave this issue open to include other overrides in the future but for now it would be best to just target it with a stylesheet

pedrouid avatar Jun 04 '20 16:06 pedrouid

Interesting, that could be useful. Theme is used for colors only... I will leave this issue open to include other overrides in the future but for now it would be best to just target it with a stylesheet

That's what I will do. Thanks! (closed by mistake)

0xTimepunk avatar Jun 04 '20 16:06 0xTimepunk

Any updates on this?

metafraction avatar Jun 14 '21 03:06 metafraction

popup Any updates?? How to solve this?

Xh0st avatar Jul 14 '21 22:07 Xh0st

Interesting, that could be useful. Theme is used for colors only... I will leave this issue open to include other overrides in the future but for now it would be best to just target it with a stylesheet

That's what I will do. Thanks! (closed by mistake)

How did you solved ?

Xh0st avatar Jul 14 '21 23:07 Xh0st

Please, z-index of 2 is not enough. Allow people to override it

rafinskipg avatar Jul 20 '21 10:07 rafinskipg

Hi @Xh0st @rafinskipg,

You just need to add the z-index in the modal calss in your global css file, like this:

.web3modal-modal-lightbox { z-index: 10 !important; }

giovas94 avatar Oct 08 '21 14:10 giovas94

Understand the trick of the class, but being able to override zIndex keeps the code much more clean. +1 for me for this feature!

70nyIT avatar Feb 03 '22 17:02 70nyIT

Please make it z-Index editable out of the box

0xNoSignal avatar Feb 18 '22 10:02 0xNoSignal

Adding js code to maintain and document when css nails it is not a good idea.

.web3modal-modal-lightbox.web3modal-modal-lightbox { z-index: 10; } mays work without the !important addition.

nicolas-zozol avatar May 16 '22 13:05 nicolas-zozol

Such a small feature, but would keep code cleaner. +1 from me.

GorgeousPuree avatar Dec 08 '22 06:12 GorgeousPuree

With stable version 2.0.0 of Web3Modal now released, we are officially dropping support for version 1.x Due to this this issue/pr was marked for closing. It is highly recommended to upgrade as 2.x will be receiving further updates that will enable functionality for some of our newer sdks like auth and push as well as support for WalletConnect v2 (See this post about WalletConnect v1 being deprecated https://medium.com/walletconnect/walletconnect-v1-0-sunset-notice-and-migration-schedule-8af9d3720d2e)

If you need to continue using Web3Modal 1.x and require this feature/fix implemented, we suggest adding it via forking V1 branch.

xzilja avatar Jan 21 '23 14:01 xzilja

For those who are struggling with this, just add this to your CSS:

body {
  --w3m-z-index: 1500;
}

carlosrsabreu avatar Apr 21 '23 16:04 carlosrsabreu

There is also a documented way: https://docs.walletconnect.com/web3modal/javascript/theming#themevariables

createWeb3Modal({
  //...
  themeVariables: {
    '--w3m-z-index': 1500,
  }
})

mqklin avatar Feb 17 '24 09:02 mqklin