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

Session Replay Mask text forces parent element to mask everything #296

Open
sterien7 opened this issue Feb 10, 2025 · 3 comments
Open

Session Replay Mask text forces parent element to mask everything #296

sterien7 opened this issue Feb 10, 2025 · 3 comments
Labels
bug Something isn't working Session Replay

Comments

@sterien7
Copy link

sterien7 commented Feb 10, 2025

Version

3.19.4

Steps to Reproduce

  1. Mask a Text() element using .postHogMask()
  2. The text element is inside a parent element which acts like a list item View
  3. if the parent element has the .clipShape modifier, the whole element gets masked instead of just the text

I use .clipShape(.rect(cornerRadius: 24))

Expected Result

The inner Text view should be masked

Image

Actual Result

The whole list item gets Masked

Image

@sterien7 sterien7 added the bug Something isn't working label Feb 10, 2025
@ioannisj
Copy link
Contributor

@sterien7 Thanks for reporting this. I'll try to replicate locally and see what may be going on here and I'll check back with you.

@sterien7
Copy link
Author

@ioannisj here is a code sample

VStack(spacing: 12) {
    Group {
        // ... Some other views
    }
    .frame(maxWidth: .infinity, alignment: .leading)

    HStack(spacing: 4) {
        // this is the text I want to mask
        Text(pet.name)
            .postHogMask()
            .paragraphStyle(.small, foregroundStyle: Color.Text.secondary)
            .lineLimit(1)
            .fixedSize(horizontal: false, vertical: true)
        
        VStack(alignment: .trailing, spacing: 2) {
            // ... Some other views
        }
        .frame(maxWidth: .infinity, alignment: .trailing)
    }
}
.padding()
.frame(maxWidth: .infinity, minHeight: 112, alignment: .top)
.background(Color.Gray._40)
.clipShape(RoundedRectangle(cornerRadius: 24))
.geometryGroup()

@ioannisj
Copy link
Contributor

Hey @sterien7, pushed a small fix to fix/clip-shape-swiftui-masking. Could you verify if this resolves the masking issue? Let me know if you notice anything unexpected.

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

No branches or pull requests

3 participants