Skip to content

[v7] Opacity + stroke renders differently when objectCaching is disabled (works correctly in v5) #10867

@MassoudFSharifi

Description

@MassoudFSharifi

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

7.1.0

In What environments are you experiencing the problem?

Chrome

Node Version (if applicable)

22.12.0

Link To Reproduction

https://codesandbox.io/p/devbox/y6ct9c

Steps To Reproduce

In Fabric v7, applying opacity < 1 to an object with both fill and stroke produces a visible inner stroke blending artifact when objectCaching is set to false.

When objectCaching is true (default), the rendering appears correct.

In Fabric v5, this issue does not occur — opacity behaves consistently and does not produce the inner stroke blending artifact.

This suggests a behavioral change or inconsistency in the v7 rendering pipeline.

opacity=1

Image Image

<--->

opacity=0.7

Image Image

Expected Behavior

  • Opacity should affect both fill and stroke uniformly.
  • Rendering should be visually consistent regardless of objectCaching value.
  • Behavior should match Fabric v5, where no inner stroke blending artifact appears.

Question:

  1. Is this difference in behavior between v5 and v7 intentional due to the new rendering/caching architecture, or is it considered a regression?
  2. Should opacity compositing behave consistently regardless of objectCaching?

Actual Behavior

with objectCaching: false , When opacity < 1, the inner half of the stroke visibly blends with the fill, creating a darker inner edge.
With: objectCaching: true, Rendering appears visually correct.

Comparison with v5
Using the same configuration in Fabric v5:

  • No inner stroke blending artifact occurs
  • Opacity renders consistently
  • paintFirst: 'stroke' prevents visible overlap artifacts

Error Message & Stack Trace

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions