From 52afb41bab3d9ebe5cf2d1a4ec66a3f8fb63b7b5 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 6 Apr 2020 16:49:37 +0200 Subject: [PATCH] js: fix errors on browsers not supporting window.scroll options IE and Safari only know about `window.scroll(x, y)`, and not the form with options. --- app/views/users/feedbacks/create.js.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/users/feedbacks/create.js.erb b/app/views/users/feedbacks/create.js.erb index c2b5f9c9f..3923caada 100644 --- a/app/views/users/feedbacks/create.js.erb +++ b/app/views/users/feedbacks/create.js.erb @@ -1,3 +1,7 @@ -window.scroll({ top: 0, left: 0, behavior: 'smooth' }); +try { + window.scroll({ top: 0, left: 0, behavior: 'smooth' }); +} catch { + window.scroll(0, 0); +} <%= remove_element('#user-satisfaction') %> <%= render_flash %>