diff --git a/common/changes/@uifabric/utilities/sopurand-TryCatchForRTL_2017-06-07-18-51.json b/common/changes/@uifabric/utilities/sopurand-TryCatchForRTL_2017-06-07-18-51.json new file mode 100644 index 0000000000000..f3447c83dc71c --- /dev/null +++ b/common/changes/@uifabric/utilities/sopurand-TryCatchForRTL_2017-06-07-18-51.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@uifabric/utilities", + "comment": "Adding a try-catch around setting RTL in local storage for the browser", + "type": "patch" + } + ], + "packageName": "@uifabric/utilities", + "email": "sopurand@microsoft.com" +} \ No newline at end of file diff --git a/packages/utilities/src/rtl.ts b/packages/utilities/src/rtl.ts index 80f7c7a60ec31..04fa5b623312b 100644 --- a/packages/utilities/src/rtl.ts +++ b/packages/utilities/src/rtl.ts @@ -49,7 +49,11 @@ export function setRTL(isRTL: boolean, avoidPersisting = false) { let win = getWindow(); // tslint:disable-next-line:no-string-literal if (win && win['localStorage'] && !avoidPersisting) { - localStorage.setItem('isRTL', isRTL ? '1' : '0'); + try { + localStorage.setItem('isRTL', isRTL ? '1' : '0'); + } catch (e) { + /* swallow the exception, because safari private mode does not have local storage */ + } } _isRTL = isRTL;