1

I have a pre element that has a bunch of read-only text in it and I now have spell-checking working on the pre. However, if I right-click on the text that has the spelling error, I am able to change the value in the pre element. Is there any way to prevent the auto-suggestion from populating for this element?

Edit: I want to keep the spell-checking. I don't want the user to be able to right-click to auto-correct the mis-spelled word. I do want them to be able to add the mis-spelled word to their dictionary though.

  • Possible duplicate of [Disable spell-checking on HTML textfields](https://stackoverflow.com/questions/254712/disable-spell-checking-on-html-textfields) – Agney Nov 13 '18 at 18:25

1 Answers1

0

You can use spellcheck=false with textarea and input.

Here is a fiddle with and without spellcheck property it: https://stackblitz.com/edit/react-kmyptb

EDIT:

More info at : https://www.tutorialrepublic.com/faq/how-to-disable-spell-checking-in-html-forms.php

Saurabh Nemade
  • 1,522
  • 2
  • 11
  • 20
  • I don't want to disable spell-checking. I want spell-checking. I just don't want the user to be able to auto-correct the spelling after they right-click on the mis-spelled word. Does that make sense? – evanrich3891 Nov 13 '18 at 18:26
  • Basically you want to disable items in context menu. It is not possible as of now. You can check https://stackoverflow.com/questions/30704264/how-to-access-chrome-spell-check-suggestions-in-javascript for details on it since api is no more exposed. You can have custom context menu (only with firefox ) or you can totally hide it. https://www.w3schools.com/tags/att_global_contextmenu.asp – Saurabh Nemade Nov 13 '18 at 18:55
  • Is there any way to capture the event that happens when a user would click the suggestion to insert into the element? – evanrich3891 Nov 13 '18 at 20:26
  • No. Browser specific context menu event capturing api is not yet exposed by any browser. – Saurabh Nemade Nov 13 '18 at 20:49
  • Yeah that's what it seemed like from browsing around. I was hoping there was some work-around but it doesn't seem like there is one. – evanrich3891 Nov 13 '18 at 21:17