Skip to content

WS - Members - Avatars group on final screen moves to the left if admin invites more 8 users #22685

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open and login with expensifail account to staging.new.expensify.com or Expensify App
  2. Go to existing or create new workspace
  3. Go to Workspace > Members
  4. Click / Tap 'Invite'
  5. Select more then 8 users
  6. Click 'Next'

Expected Result:

The avatar group on the final screen is always in the center

Actual Result:

The avatars group on final screen moves to the left if admin invites more 8 users
The shift to the left gets bigger with each user added

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.39.5

Reproducible in staging?: Yes

Reproducible in production?: Yes

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6124175_WS-Invite-users-avatars-cut.mp4

Bug6124175_WS-Invite-users-avatars-cut

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Activity

  1. added
    Daily
    Bug
    on Jul 11, 2023
  2. melvin-bot commented on Jul 11, 2023

    @melvin-bot

    Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. melvin-bot commented on Jul 11, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. StevenKKC commented on Jul 11, 2023

    @StevenKKC
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Avatars group on final screen moves to the left if admin invites more 8 users.

    What is the root cause of that problem?

    Avatar group's width is calculated as below.

    if (props.icons.length > 4) {
    const length = avatarRows.length > 1 ? Math.max(avatarRows[0].length, avatarRows[1].length) : avatarRows[0].length;
    width = oneAvatarSize.width + overlapSize * 2 * (length - 1) + oneAvatarBorderWidth * (length * 2);
    } else {
    // one avatar width + overlaping avatar sizes + border space
    width = oneAvatarSize.width + overlapSize * 2 * (props.icons.length - 1) + oneAvatarBorderWidth * (props.icons.length * 2);
    }

    // Slice the icons array into two rows
    const firstRow = props.icons.slice(rowSize);
    const secondRow = props.icons.slice(0, rowSize);

    If have more than 8 avatar, length would be greater than props.maxAvatarsInRow (4).
    So avatar group moves to the left.

    What changes do you think we should make in order to solve the problem?

    Avatar group's width should be equal to or less than props.maxAvatarsInRow.
    We can change code as below.

    -   const length = avatarRows.length > 1 ? Math.max(avatarRows[0].length, avatarRows[1].length) : avatarRows[0].length;
    +   const length = Math.min(avatarRows.length > 1 ? Math.max(avatarRows[0].length, avatarRows[1].length) : avatarRows[0].length, props.maxAvatarsInRow);

    What alternative solutions did you explore? (Optional)

    None.

  5. DrLoopFall commented on Jul 12, 2023

    @DrLoopFall
    Contributor

    There's also another issue #22632, connected to this, even though the issues are different, the root cause remains the same.
    I've made a proposal there which would solve both issues, I'll also leave a proposal below just in case.

  6. DrLoopFall commented on Jul 12, 2023

    @DrLoopFall
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Workspace members avatars group on the final screen moves to the left if the admin invites more than 8 users

    What is the root cause of that problem?

    We are using left for positioning/shifting avatars, which causes it to use more space than required.

    left: -(overlapSize * index),

    left: -(oneAvatarSize.width * 2 + oneAvatarBorderWidth * 2),

    Also, currently, we are calculating the width, as a workaround, which is also a part of the problem in this issue.

    @stitesExpensify I think the width was set as a workaround for the issue described in my proposal (the 2nd issue)

    We are using left for positioning/shifting avatars but the PressableWithoutFeedback itself is not shifted, which causes it to be clickable in both the original and shifted positions.

    If we use margin-left instead, we can remove the width, which may prevent any future issues.

    if (props.icons.length > 4) {
    const length = avatarRows.length > 1 ? Math.max(avatarRows[0].length, avatarRows[1].length) : avatarRows[0].length;
    width = oneAvatarSize.width + overlapSize * 2 * (length - 1) + oneAvatarBorderWidth * (length * 2);
    } else {
    // one avatar width + overlaping avatar sizes + border space
    width = oneAvatarSize.width + overlapSize * 2 * (props.icons.length - 1) + oneAvatarBorderWidth * (props.icons.length * 2);
    }

    What changes do you think we should make in order to solve the problem?

    Use margin-left instead of left for positioning the avatar.

    // in getHorizontalStackedAvatarStyle
    - left: -(overlapSize * index)
    + marginLeft: index > 0 ? -overlapSize : 0
    
    // in getHorizontalStackedOverlayAvatarStyle
    - left: -(oneAvatarSize.width * 2 + oneAvatarBorderWidth * 2)
    + marginLeft: -(oneAvatarSize.width + oneAvatarBorderWidth * 2)

    We should also need to remove the width, as we don't need it anymore, because this proposal also removes the need for the workaround as it fixes the issue in the root, and removing it may prevent future issues like this.

    if (props.icons.length > 4) {
    const length = avatarRows.length > 1 ? Math.max(avatarRows[0].length, avatarRows[1].length) : avatarRows[0].length;
    width = oneAvatarSize.width + overlapSize * 2 * (length - 1) + oneAvatarBorderWidth * (length * 2);
    } else {
    // one avatar width + overlaping avatar sizes + border space
    width = oneAvatarSize.width + overlapSize * 2 * (props.icons.length - 1) + oneAvatarBorderWidth * (props.icons.length * 2);
    }

  7. melvin-bot commented on Jul 14, 2023

    @melvin-bot

    @johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!

  8. huzaifa-99 commented on Jul 17, 2023

    @huzaifa-99
    Contributor

    My proposal here fixes this issue, reposting for visibility

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    We want workspace icons to be aligned to right.

    What is the root cause of that problem?

    We do a different kind of width calculation when there are more than 4 icons, but at a single time we only display 4 icons. The extra width moves the icons to left.

    if (props.icons.length > 4) {
    const length = avatarRows.length > 1 ? Math.max(avatarRows[0].length, avatarRows[1].length) : avatarRows[0].length;
    width = oneAvatarSize.width + overlapSize * 2 * (length - 1) + oneAvatarBorderWidth * (length * 2);
    } else {

    What changes do you think we should make in order to solve the problem?

    We should update the width calculation here. Since we only display a max of 4 icons, we can remove the length calculation and use 4 directly (which comes from props.maxAvatarsInRow), and simplify this whole block with this condition

    const length = Math.min(props.maxAvatarsInRow, props.icons.length)
    width = oneAvatarSize.width + overlapSize * 2 * (length - 1) + oneAvatarBorderWidth * (length * 2);
    image
    image
    image

    What alternative solutions did you explore? (Optional)

    N/A

  9. melvin-bot commented on Jul 18, 2023

    @melvin-bot

    @johncschuster 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  10. johncschuster commented on Jul 18, 2023

    @johncschuster
    Contributor

    If the root cause will be fixed in another issue, does this issue need to remain open?

    (I'm not sure, so I'm asking in Slack)

  11. johncschuster commented on Jul 20, 2023

    @johncschuster
    Contributor

    bumping my question above

  12. Santhosh-Sellavel commented on Jul 20, 2023

    @Santhosh-Sellavel
    Collaborator

    @johncschuster Yeah can close this one in favor of #22632

  13. johncschuster commented on Jul 21, 2023

    @johncschuster
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugDaily

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions