Disable auto-focus/scroll on init

Hello,

we use ONLYOFFICE Docs™ Community Edition Vers. 6.3.1 and integrated
the editor to an HTML popup/modal, not full-screen. When the editor
finished initialization, it automatically gets the zoom and the browser is scrolling
down.

We don’t want this behavior, the editor should not get the focus and
scrolling should also not happen.

I already read about setting this value, but it didn’t help:

“customization”: {
“integrationMode”: “embed”
}

Thanks for your help!

Hello @ipdoc1

Please note that this setting was added in version 7.2:
https://api.onlyoffice.com/editors/changelog#72

That said, I’d recommend you to update to the actual version and check the situation again.

Hi @Constantine

Finally, we updated to 8.1. But the problem with the auto focus / scroll still occurs. Any idea what we do wrong?

self.docEditor = new DocsAPI.DocEditor(self.$el.attr('id'), {
            "document": {
                "fileType": "docx",
                "title": self.model.get('name'),
                "url": self.documentUrl,
                "key": self.getValue()
            },
            "type": "desktop",
            "width": "100%",
            "editorConfig": {
                "callbackUrl": self.saveUrl,
                "user": {
                    "id": 'admin'
                    "name": 'admin'
                },
                "region": 'de-DE',
                "customization": {
                    "compactHeader": true,
                    "help": false,
                    "toolbarHideFileName": true,
                    "toolbarNoTabs": true,
                    "plugins": false,
                    "reviewDisplay": 'markup',
                    "integrationMode": "embed"
                },
                "isReadOnly": false
            },
            "events": {
                "onAppReady": function () {
                },
                "onDocumentReady": function () {
                },
                "onDocumentStateChange": function (e) {
                }
            },
        });

Thanks!

Can you provide a video demonstration of this behavior? I do believe it is related to the focus on the editor once the page is loaded but I want to make sure that I understand it correctly.

As I can see you have several events declared, what functions do they execute? Have you tried loading the editor without these events to see if there is any difference? I wasn’t able to reproduce the issue with simple HTML though.

Here is a clip of the behavior:

Before recording, I removed the empty event handlers but it didn’t have any effect.

After the editor loaded, the window jumps automatically down and the editor gets the focus. Typing is already bound to the editor.

Thank you for the video. That is weird behavior, indeed. Do you call new window inside the page or this is completely separate window?

What do you mean by window? It’s only one HTML page, no iframes etc. The popup you see is just a standard bootstrap modal.

I think I was able to reproduce the issue by building simple HTML with modal window according to this documentation:

Can you confirm that you’ve implemented it in the same way?

Yes, we also use BS modals. But what exactly causes the focus after the editor has finished loading? The modal itself is already rendered!?

It could be the case. Can you share sample of your implementation of modal with editor? In my test modal is shown right after page is loaded and when editor loads too, the focus goes to the editor:

$('#modal-content').modal({
  show: false
});

However, I am not familiar with your implementation of modal with editor, i.e. in which case or under which conditions editor should be rendered. Possibly solution would be to call modal without editor at first so that focus stays in required field and then append editor by pressing specific button, e.g. Preview in your video.