Skip to content

Keep org chart avatars inside their cards in Safari - #103

Merged
IanCou merged 1 commit into
candiedoperation:masterfrom
benmross:fix/orgchart-avatar-safari
Oct 22, 2026
Merged

IanCou merged 1 commit into
candiedoperation:masterfrom
benmross:fix/orgchart-avatar-safari

Conversation

@benmross

Copy link
Copy Markdown
Contributor

Description

In Safari, the profile photos on the Org Chart (/org/chart) render in a row at the top of the chart instead of inside each person's card, and the cards show no avatar at all. Chrome and Firefox are unaffected.

Each card is HTML inside an SVG <foreignObject>, and the shadcn Avatar root is relative overflow-hidden. WebKit paints positioned elements inside a foreignObject relative to the SVG origin and ignores the transform that react-d3-tree puts on each node's <g>, so every avatar lands near the top left of the canvas.

This adds static to the Avatar's classes in OrgChartVisualization.tsx only. tailwind-merge drops relative in favour of it, and the round crop still works because overflow-hidden with rounded-full does not need positioning. The shared Avatar component is unchanged.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Chore / dependency update

Testing

On corp.appdevclub.com in Safari, unticking position: relative on an avatar's span[data-slot="avatar"] in Web Inspector moves the photo back into its card. That is the same change this PR makes in code. Locally: vitest run passes (29), prettier --check and eslint are clean for the file, and vite build succeeds.

Screenshots

Before (Safari): photos at the top of the chart, cards without avatars. I can add the screenshot in a comment.

Checklist

  • Self-reviewed my own code
  • No console.log / debug statements left in
  • Tested locally

WebKit paints positioned elements inside an SVG foreignObject against the
SVG origin and ignores the transforms react-d3-tree puts on each node, so
the Avatar root (relative overflow-hidden) rendered every photo in a row at
the top of the chart. static drops the positioning; the rounded clip still
works without it.

@IanCou IanCou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on safari

@IanCou
IanCou merged commit a1dfb75 into candiedoperation:master Oct 22, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants