Spell check not working in Sanity studio, solution found

5 replies
Last updated: Feb 10, 2022
Hi, from what I see in the doc , the PTE should allow spell checking. But from what I have in my studio that's not the case.Spell check is working in
text
fields.I'm working with v.2.27 of Sanity.
AI Update

You're right that spellchecking should work in the Portable Text Editor - and it does support it! The issue you're experiencing in Sanity Studio v2.27 is likely because spellcheck needs to be explicitly enabled in your schema configuration.

The Portable Text Editor does support spellchecking through the spellCheck option on the block type. While this option defaults to true, there have been cases in Studio v2 where it needs to be explicitly set to work properly.

Here's how to fix it - add the spellCheck option to your block type's options object:

{
  title: 'Content',
  name: 'content',
  type: 'array',
  of: [
    {
      type: 'block',
      options: {
        spellCheck: true
      }
    }
  ]
}

The key is placing spellCheck: true inside the options object at the block type level. This is a Boolean option that explicitly enables spellchecking in the Portable Text Editor.

After updating your schema with this configuration, restart your Studio development server. The spellcheck functionality should then work in your Portable Text fields just like it does in your regular text fields.

If you're still experiencing issues after adding this, double-check that:

  • The option is nested correctly within the options object
  • Your browser's spellcheck isn't disabled globally
  • You've fully restarted the Studio (not just refreshed the page)

This should resolve the spellcheck issue you're seeing in Studio v2.27's Portable Text Editor.

Hi Sixclones. Possible nice find! I usually keep spell checking off in my browsers unless I need it. But as an FYI, I am able to recreate this. Chrome 98.0.4758.80, macOS 12.2. A similar portable text field and spelling error in studio v2.27 - and a comment field on a random public site for comparison. I can’t say for certain that browser spell check was happening in the studio prior to this.
I have reached out to the studio team with my own test results and will follow up. Thank you!
I checked spell checking in firefox and chrome. The team suggested this and it works for me.
in your portableText object, add

options: {
  spellCheck: true
},
Adding this explicit option appears to have done the trick for me! Here is portabletext object file in my tester for reference:



export default {
  title: 'Portable Text',
  name: 'ptext',
  type: 'array',
  of: [
    {
      title: 'Block',
      type: 'block',
      options: {
        spellCheck: true
      },
      styles: [
        {title: 'Normal', value: 'normal'},
        {title: 'H1', value: 'h1'},
        {title: 'H2', value: 'h2'},
        {title: 'H3', value: 'h3'},
        {title: 'H4', value: 'h4'},
        {title: 'Quote', value: 'blockquote'}
      ],
      lists: [{title: 'Bullet', value: 'bullet'}],
      marks: {
        decorators: [
          {title: 'Strong', value: 'strong'}, 
          {title: 'Emphasis', value: 'em'}],
        annotations:[
          {
            title: 'URL',
            name: 'link',
            type: 'object',
            fields: [{title: 'URL', name: 'href', type: 'url',}]
          }
        ]
      }
    },
    /* adtnl types */
    {type: 'image', hotspot: true}
  ]
}

Ah I tried the
spellCheck
option but I misused it. Thanks for the answer! I confirm it's working on my side now. 🙂FYI the doc is saying that this option is
true
by default but it seems to not be the case.
This is secondhand info for me, so please don’t take it as official. But from what I understand the flag should be true for all browsers except chrome by default. Chrome apparently has been experiencing performance issues with spell checking, and this was disabled just for chrome. BUT from my own testing, the flag is apparently false for all browsers if left undefined.
They are discussing this now, and I’m sure either a noted behavior update will be made or the default flag will be set back soon, chrome performance willing. Thank you for finding this!

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?