From 6cad9b003326a18d4b4d3a1372f221a274dbde38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 16 Mar 2016 17:24:24 +0100 Subject: [PATCH] Remove required attribute of empty translated fields Translations for `:multi_locale` fields are set to '', which is a problem when they're set to `required="true"` since Chrome will try to focus that element, which is invisible and cause a horrible `An invalid form control with name='...' is not focusable` error. --- app/assets/javascripts/application.js.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 739612c3af60..4b44460fbfdc 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -985,7 +985,9 @@ var I18nForms = (function ($) { new_translation.hide(); new_translation.find('.destroy_flag').val('1') .attr('disabled', false); - new_translation.find('input, textarea').val(''); + new_translation.find('input, textarea').val('') + .removeAttr('aria-required') + .removeAttr('required'); new_translation.find('.locale_selector').val(locale); new_translation.insertAfter(translations.first());