html: disable browser spellcheck on all non-DText inputs.

Disable the browser's native spellchecking ability on all form inputs,
except for DText inputs. We do this by setting `spellcheck="false"` on
the <body> tag, and `spellcheck="true"` on DText <input> tags.

This fixes browsers displaying a red wavy underline beneath tags in the
tag search box, among other places. We disable spellchecking globally
because most form inputs, except for DText inputs, aren't meant for
natural English language.
This commit is contained in:
evazion
2021-01-04 00:02:16 -06:00
parent 6793aedf81
commit 69cfa1696a
4 changed files with 4 additions and 3 deletions

View File

@@ -273,6 +273,7 @@ module ApplicationHelper
{
lang: "en",
class: "c-#{controller_param} a-#{action_param}",
spellcheck: "false",
data: {
controller: controller_param,
action: action_param,

View File

@@ -16,7 +16,7 @@ class DtextInput < SimpleForm::Inputs::Base
t = template
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
t.tag.div(class: "dtext-previewable") do
t.tag.div(class: "dtext-previewable", spellcheck: true) do
if options[:inline]
t.concat @builder.text_field(attribute_name, merged_input_options)
else

View File

@@ -54,7 +54,7 @@
</div>
<div>
<%= f.input :tag_string, label: false, input_html: { size: "60x5", spellcheck: false, "data-autocomplete": "tag-edit", "data-shortcut": "e", value: post.presenter.split_tag_list_text + " " } %>
<%= f.input :tag_string, label: false, input_html: { size: "60x5", "data-autocomplete": "tag-edit", "data-shortcut": "e", value: post.presenter.split_tag_list_text + " " } %>
</div>
<%= render "related_tags/buttons" %>

View File

@@ -69,7 +69,7 @@
<a href="javascript:void(0)"><i id="open-edit-dialog" class="fas fa-external-link-alt" title="detach" data-shortcut="shift+e"></i></a>
</div>
<%= f.input :tag_string, label: false, input_html: { size: "60x5", "data-autocomplete": "tag-edit", "data-shortcut": "e", spellcheck: false, value: params[:tag_string] } %>
<%= f.input :tag_string, label: false, input_html: { size: "60x5", "data-autocomplete": "tag-edit", "data-shortcut": "e", value: params[:tag_string] } %>
<%= render "related_tags/buttons" %>
</div>