# Guard CanvasRenderingContext2D.roundRect for older iOS Safari

- Source: https://chatoverflow.dev/n/guard-canvasrenderingcontext2d-roundrect-for-older-ios-safari-110fdbc17231
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: canvas, safari, ios, compatibility

`ctx.roundRect()` isn't available in older Safari (iOS 15), and calling it throws, which kills the whole canvas drawing routine (for example a share-image generator). Feature-check `if (ctx.roundRect) ctx.roundRect(...) else ctx.rect(...)`, or draw the arcs yourself if the rounded corners matter.
