For something we've built, the default new item form contains a publishing HTML field. For some unknown reason, when SharePoint displays this new item form, it drops the cursor into this publishing HTML field. That has consequences for the ribbon.

I need to get SharePoint to drop the cursor on the first field rather than this one. Is there in fact a way to do this?

  • Do you have access to edit the page code? Add some JS to the page that holds the form? – IE5Master Dec 15 '16 at 21:27

I've blogged about this before, this was for 2010, so I'm not sure if it will work for 2013 so you might have to test/adjust but it is a good starting point, http://ericjalexander.com/blog/2013/08/14/Publishing-HTML-Column-Frustrations.

Lately I’ve been doing a lot of work in the publishing/WCM area and one thing that’s really aggravated me is that when you have a content type created for a page layout Sharepoint tries to be too cutesy when you edit the metadata for the item.

When you try to edit properties of the page, Sharepoint’s awesome UX will find the first Publishing HTML field and set that as the focused item no matter where it is in the content type order. So if it’s the last field in your content type, it steals the focus from the first field. This is horrible UX in that I want to fill my metadata from the top down, that’s precisely why I ordered the columns the way I did.

Another side effect is that if you use Google Chrome and try to select a drop down list value while this field has focus, the drop down will autmatically collapse on you, again poor UX. This Page library is also using modal dialogs because if you don’t, you can’t properly use the rich html tools the field provides in Chrome either.

So I was looking for a fix. I came across a post from Rob mentioning this weird behavior but no real mention of a fix. In my Binging I also found this lovely MSDN article that specifies there is an override for this lovely “feature”. So I have to create a bunch of server side code to fix this poor UX? Surely there has to be a better option.

Since this editform already has some jQuery on it for other enhancements I thought I’d be able to fix this straight away no problem. Tried the typical document.ready things like $("input[Title='Title']").click() and $("input[Title='Title']").focus() to no avail. Turns out this information is loaded asynchronously. Yippee, time to dig around in the SOD javascript files.

After parusing through some of the on demand files and some trial and error, I finally came up with a hacky fix to get the focus out of the publishing html field and back up to the top of my form. Put this into a script tag:

function waitUnitStuffIsLoaded() {

function refocus(){

SP.SOD.executeOrDelayUntilScriptLoaded(waitUnitStuffIsLoaded, "sp.ui.spellcheck.js"); 

I tried a lot of the js files that were loaded on demand, like ribbon.js and this was the only one I found that worked.

  • Eric, it worked! The field title (as it turns out) is "Title Required Field", but that's no problem considering the code is in a page-local script editor. It still doesn't solve the problem of the disappearing ribbon, but hey, one problem at a time. Thanks very much. – Josh Korn Dec 19 '16 at 17:44

I had the same problem. I added some JS:


function changeInitialFocus() {
    WPQ2FormCtx.InitialFocus = null;
    var form = SPClientForms.ClientFormManager.GetClientForm('WPQ2');
    if (form != null) form.RenderClientForm();



To the initial FieldName to get the focus on the desired field. With the value


no field has a focus and the view stays at the top of the page.


If you don't want to focus on any other field instead just avoid focusing on anything. Like I'm using SharePoint 2013 and have rich html fields in page layout, I didn't want the focus on anything; just to show the start of the page as is..

For this I override the existing method in sp.ui.rte.publishing.js file as follows:

SP.SOD.executeFunc('sp.ui.rte.publishing.js', 'SP.ClientContext', function () {
   RTE.Canvas.initialFocusOnRichText = function () { };

It stopped the focus on rich html field.

I didn't find any console errors or undesired behavior in rich html field after adding this, however if someone notice please do comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.