🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Issue with adding external link URL in Sanity studio's rich text field

10 replies
Last updated: Apr 18, 2024
Hey Everyone! New to Sanity, so I hope this isn't a stupid question. Has anyone encountered an issue where I want to add an external link URL in a rich text field inside the Sanity studio, but the box which asks for entering the URL just closes when I click inside it? When I click the edit link pencil icon it just flickers (disappears and then appears again). After much trial and error across many browsers I finally managed to insert a link by accessing the studio in chrome on a mobile device - but that still required dozens of attempts to write inside the field, and it's a pain in the... I don't understand the problem beyond it complaining about 3rd party cookies (even when they're enabled) and websocket closing before a handshake. Does this work normally for y'all or is it a known issue? I feel like I'm the only idiot in the room, but otherwise I set up everything correctly, even the portableText configuration for rendering inside the Next.js app. But since this happens inside the studio I didn't know where else to look since I don't understand any of the code there.
Apr 17, 2024, 7:57 PM
👋 What version of the Studio are you running?
Apr 17, 2024, 8:28 PM
Hi rd, thanks for replying. i'm using these versions: @sanity/cli (global) 3.36.3 (latest: 3.38.0)@sanity/cli 3.38.0 (up to date)
@sanity/eslint-config-studio 4.0.0 (up to date)
@sanity/icons 2.11.8 (up to date)
@sanity/vision 3.36.3 (latest: 3.38.0)
sanity 3.36.3 (latest: 3.38.0)
Apr 17, 2024, 9:19 PM
Can you try updating to the latest versions of everything to see if that fixes it?
Apr 17, 2024, 9:20 PM
incredible, it fixed it indeed. thanks! it's funny because i started working with Sanity about a week ago, guess that was a fresh bug or there was some conflict? works like a charm now!
Apr 17, 2024, 9:29 PM
Glad it was an easy fix! We do our best but bugs do indeed show up in some releases.
Apr 17, 2024, 9:30 PM
thanks so much, i got into building a prototype for a new website for a client using some crappy page builder, and am demonstrating the power of headless cms, and fell in love with sanity. i freaked out with this bug because i thought i'd have to tell them they couldn't use links in their content 🙂 thanks a bunch for the quick reply!
Apr 17, 2024, 9:32 PM
Yay! I’m glad you’re loving it!
Apr 17, 2024, 9:42 PM
one more thing... i messed around with it some more and ran into the same problem again, even with all the versions updated. but when i changed the URL type from url to string, it worked fine again. so if someone gets the same issue, try that as well in your schema. annotations: [ {
title: 'URL',
name: 'link',
type: 'object',
fields: [
title: 'URL',
name: 'href',
type: 'string', <---
], (...) absolutely no idea why though, but it's messing with the box for sure.
Apr 17, 2024, 10:07 PM
Hm, that is odd. Which browser is it happening in?
Apr 17, 2024, 10:13 PM
I tested in chrome, edge and firefox, as well as chrome mobile before giving up and just setting it to string type. I can probably use some regex validations if necessary, but the important thing is I found how to make it work. the rest is just a bonus 🙂 but yeah, definitely sounds like something that shouldn't happen, and I haven't found anyone else with such issues when googling. that's when I decided to try asking here. I would test it in more browsers but I don't have any others.
Apr 18, 2024, 2:48 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?