question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better implementation of Avatar Group (remove z-index)

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

Avatar Group should be implemented without z-index to reduce interference with other components that uses z-index

Current Implementation:

   <div className={clsx(classes.root, className)} ref={ref} {...other}>
     {children.slice(0, children.length - extraAvatars).map((child, index) => {
       return React.cloneElement(child, {
         className: clsx(child.props.className, classes.avatar),
         style: {
           zIndex: children.length - index,
           marginLeft: index === 0 ? undefined : marginLeft,
           ...child.props.style,
         },
       });
     })}
     {extraAvatars ? (
       <Avatar
         className={classes.avatar}
         style={{
           zIndex: 0,
           marginLeft,
         }}
       >
         +{extraAvatars}
       </Avatar>
     ) : null}
   </div>

Personally, I believe that this should be implemented with the innate HTML order priority. We can achieve this buy simply applying row-reverse to root and reversing the order of children.

P.S. I think we should also have a stackingDirection property that lets change change if we want it to stack RTL or LTR

I will be happen to open a PR if my suggestion is accepted

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Jun 29, 2020

@nvdai2401 The author of the issue might be working on it.

However, our policy is to wait 7 days before giving an issue to somebody else. If we don’t hear back in two days, I think that it’s safe to work on 😃

0reactions
oliviertassinaricommented, Jul 3, 2020

Sure 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Better implementation of Avatar Group (remove z-index) #21562
Summary. Avatar Group should be implemented without z-index to reduce interference with other components that uses z-index. Current ...
Read more >
How to set the zIndex on the drawer component - Stack Overflow
I am trying to acheive the clipped under the app bar style temporary drawer. But I can't seem to be able to set...
Read more >
Better z-index management with Sass | by ventrebleu - Medium
The principle of this approach is to surface the layers used in an application by expressively naming them in a Sass map and...
Read more >
z-index - CSS-Tricks
The z-index property in CSS controls the vertical stacking order of elements that overlap. As in, which one appears as if it is...
Read more >
What No One Told You About Z-Index : r/programming - Reddit
There is a very good reason. If you have a negative Z-index on an element that's not in a local stacking context, it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found