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

ConnectModal SVG Icons show incorrectly #581

Closed
LCJove opened this issue Feb 23, 2024 · 7 comments · Fixed by #616
Closed

ConnectModal SVG Icons show incorrectly #581

LCJove opened this issue Feb 23, 2024 · 7 comments · Fixed by #616
Assignees
Labels
bug Something isn't working

Comments

@LCJove
Copy link
Collaborator

LCJove commented Feb 23, 2024

steps:

  1. open Basic Usage Modal, route to get MetaMask
  2. close current modal
  3. open another Modal, route to get MetaMask to
  4. the chrome icon miss a part of style

image

@LCJove LCJove added the bug Something isn't working label Feb 23, 2024
@LCJove LCJove self-assigned this Feb 23, 2024
@LCJove
Copy link
Collaborator Author

LCJove commented Feb 23, 2024

目前看来是只有使用了defs来设置fill颜色的时候会导致样式缺失;
另外把metamask 的icon和chrome的icon换一下,也是能正常显示

@yutingzhao1991
Copy link
Collaborator

目前看来是只有使用了defs来设置fill颜色的时候会导致样式缺失; 另外把metamask 的icon和chrome的icon换一下,也是能正常显示

看看是不是和 #310 这个问题类似

@LCJove
Copy link
Collaborator Author

LCJove commented Feb 27, 2024

目前看来是只有使用了defs来设置fill颜色的时候会导致样式缺失; 另外把metamask 的icon和chrome的icon换一下,也是能正常显示

看看是不是和 #310 这个问题类似

是类似的,多个不同svg里面的defs的id一样的话,有可能出现问题

@LCJove
Copy link
Collaborator Author

LCJove commented Feb 27, 2024

调研下来,这个问题是比较常见的,思路有这么一些:

  1. 运行时,给每个svg实例里的id添加uniqId。
  2. 将defs的内容写成内联的形式,即删除掉defs。

1的方式需要对AntdIcon做变动。
2的方式,渐变色不好支持内联的形式,这部份的icon可能没有办法做

@LCJove
Copy link
Collaborator Author

LCJove commented Mar 1, 2024

目前看来是只有使用了defs来设置fill颜色的时候会导致样式缺失; 另外把metamask 的icon和chrome的icon换一下,也是能正常显示

看看是不是和 #310 这个问题类似

是类似的,多个不同svg里面的defs的id一样的话,有可能出现问题

一个触发的条件是先展示的icon的display属性变成none(modal被隐藏),可以参考这个
https://codesandbox.io/p/sandbox/svgbug-2ckdcx?file=%2Fsrc%2FApp.tsx

@gin-lsl
Copy link
Collaborator

gin-lsl commented Mar 1, 2024

这个问题是因为 chrome 的图标,在一个页面上用了多次,然后最前面的那个,被隐藏了的原因是吗?

@jeasonstudio
Copy link
Collaborator

cc @yutingzhao1991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants