Rendering issues in Safari 11 or other browsers on iOS 11

Troubleshooting

Summary

How to resolve rendering issues in Safari 11 or other browsers on iOS 11.

This article was written for an older version. It is only online as a reference for customers using this old version. The information it contains is probably out of date.

The latest information can be found in the yFiles documentation

Description

A regression in Safari 11 or other WebKit-based browsers on iOS 11 breaks references to objects that are stored as custom data attribute on the elements. For more information see this WebKit bug report: https://bugs.webkit.org/show_bug.cgi?id=175023

yFiles for HTML uses a mechanism to efficiently update the transformable of an SVG element through a stored object. When those references are not valid anymore, updating the transformable has no effect which may appear as the following rendering issues:

  • Missing graph elements
  • Viewport changes seem broken
  • Centering of the graph does not work
  • Selection/Highlight indicator are not zoomed properly
  • etc.

Workaround

To resolve this problem, please enable the following workaround

yfiles.workaroundCR320635 = true;
Workaround flag workaroundCR320635 does also address the following issues:
- Slow SVG rendering in Firefox due to a problem in Firefox's SVG rendering engine.
- Chrome 57 does not apply the SVG transform matrix to the GraphComponent's SVG element.

The workaround basically disables the update mechanism which is why you should enable this workaround only in the affected browsers, which is Safari 11 on both, iOS and Mac OS X, or any other WebKit-based browser on iOS 11.

For example, browser sniffing may look like this

  /**
   * Returns version of Safari.
   * @return {number} Version of Safari or -1 if browser is not Safari.
   */
  function detectSafariVersion() {
    const ua = window.navigator.userAgent;
    const isSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1;
    if (isSafari) {
      const safariVersionMatch = ua.match(new RegExp('Version\\/(\\d*\\.\\d*)', ''));
      if (safariVersionMatch && safariVersionMatch.length > 1) {
        return parseInt(safariVersionMatch[1]);
      }
    }
    return -1;
  }

  /**
   * Returns true for browser running on iOS11 (these are all actually WebKit Safari browsers).
   * @return {boolean}
   */
  function detectIOS11() {
    if (detectSafariVersion() === 11) {
      return true;
    }
    const ua = window.navigator.userAgent;
    return !!(/OS\s+11_.*(CriOS|FxiOS)/.exec(ua));
  }

  // Workaround for transformable caching regression in Safari 11 or other WebKit browser on iOS 11
  if (detectIOS11()) {
    yfiles.workaroundCR320635 = true;
  }
yFiles for HTML comes with several workarounds to resolve certain browser issues, which can be enabled on demand. For more information about workarounds, please see this Knowledge Base article: Browser issues and included workarounds.

Categories this article belongs to:
yFiles for HTML
Applies to:
yFiles for HTML: 1.4, 2.0, 2.1
Keywords:
workaround - workaroundCR320635 - workarounds - Safari - iOS - Mac OS X - rendering