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

Unexpected behavior: position: relative on ancestor affects border-radius #3

Open
sdtsui opened this issue Aug 14, 2017 · 1 comment

Comments

@sdtsui
Copy link

sdtsui commented Aug 14, 2017

Expected Behavior: jazzicons should function as isolated components, style of wrapper elements shouldn't affect behavior (for example, application of key styles like border-radius).

Current Behavior: (exploration was timeboxed to 30mins, didn't dig too deep into lib code)

  • When an Identicon is rendered as a descendant of an element with position: relative, border radius does not work. Icons are square instead of rounded.
  • Examining dev tools, border-radius appears to be getting overridden to 0 by css reset, but deleting our reset.(s)css does not have any effect.
  • (Here's the weird part...) Rendering another Identicon as a sibling to the ancestor also somehow fixes the problem for both Identicons. See .gif:
    jazzicon-weirdness
  • Starts by rendering two, rounded/'fixed'
  • Comment out the sibling of relatively positioned ancestor...refresh.
  • Border Radius no longer applies.

Status:
I was able to fix with this change, by isolating my use of position: relative to avoid touching the Identicon. Flagging in case it'll be useful for others using this lib. This linked commit also constitutes reproduction steps: check out the commit before it, and npm run dev -- the main icon should be square instead of rounded.

@FlySwatter - I should point out: this issue might have more to do with identicon/icon factory code then jazzicon, but I figured this was the best place to document. Let me know what you think. Thanks!

@danfinlay
Copy link
Owner

Awesome work!! I'd known there was some strange behavior regarding this, but hadn't pinned it down. A timebox was a good strategy, and I'm so happy you found a workaround, although the fundamental bug almost sounds like a browser rendering issue.

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

No branches or pull requests

2 participants