
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis error typically occurs in Sanity Studio when working with Portable Text fields, particularly when applying block-level styles like headings (h1-h6). The Cannot read properties of null (reading 'scrollTop') error suggests the Portable Text editor is trying to access a DOM element that hasn't been properly rendered or has been unmounted.
Here are the most effective solutions to try:
1. Update Sanity Studio to the latest version
The most common fix is ensuring you're running a current version of Sanity Studio, as various scrolling and focus-related bugs in the Portable Text editor have been addressed over time:
npm install sanity@latestAfter updating, restart your dev server with npm run dev or sanity dev.
2. Check your Portable Text schema configuration
Make sure your block content field is properly configured. A basic working configuration looks like this:
{
name: 'content',
type: 'array',
of: [
{
type: 'block',
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
// ... other heading levels
]
}
]
}3. Clear browser cache and Studio data
Sometimes cached data can cause rendering issues:
.sanity folder in your project directory4. Check for conflicting custom plugins or configurations
If you're using custom Portable Text configurations, plugins, or custom components within your blocks, these could be interfering with the editor's scroll behavior. Try temporarily removing customizations to isolate the issue.
5. Temporary workarounds while troubleshooting
If you need to keep working while investigating:
If the problem persists:
This could indicate a more specific issue with your setup. The Sanity community on Slack is very responsive and helpful for troubleshooting. When asking there, include:
sanity --version)The scrollTop error is usually resolved by keeping Studio updated, as the Portable Text editor receives regular improvements and bug fixes with each release.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store