Bug 245420 - Safari 16 fails to correctly apply strokeStyle to canvas paths
Summary: Safari 16 fails to correctly apply strokeStyle to canvas paths
Status: RESOLVED DUPLICATE of bug 245145
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari Technology Preview
Hardware: All iOS 16
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-20 04:07 PDT by Paul Neave
Modified: 2022-09-20 18:36 PDT (History)
1 user (show)

See Also:


Attachments
Demo HTML/JS (555 bytes, text/html)
2022-09-20 04:07 PDT, Paul Neave
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Neave 2022-09-20 04:07:30 PDT
Created attachment 462469 [details]
Demo HTML/JS

Major bug in Safari 16 (iOS and macOS) when drawing paths with strokeStyle in 2D canvas. 

The demo code below draws three small lines. One red, one blue, and the last one red.

In Safari 16, the third line is incorrectly colored blue.

```
<html>
<body>
<canvas id="canvas"></canvas>
<script>

const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');

context.lineWidth = 6;

context.beginPath();
context.strokeStyle = 'red';
context.moveTo(30, 50);
context.lineTo(50, 50);
context.stroke();

context.beginPath();
context.strokeStyle = 'blue';
context.moveTo(60, 50);
context.lineTo(80, 50);
context.stroke();

context.beginPath();
context.strokeStyle = 'red';
context.moveTo(90, 50);
context.lineTo(110, 50);
context.stroke();

</script>
</body>
</html>

```

In all other browsers, including previous versions of Safari, the strokeStyle color is adhered to on a third call. In Safari 16, it does not update the color and it stays on the previous color.
Comment 1 Alexey Proskuryakov 2022-09-20 18:36:49 PDT

*** This bug has been marked as a duplicate of bug 245145 ***