Commit 8950f09c authored by Remon Huijts's avatar Remon Huijts
Browse files

Explain focus() override reason

parent f882f521
......@@ -245,7 +245,15 @@ Sidebar.prototype.addPaletteFunctions = function(id, title, expanded, fns) {
this.old_addPaletteFunctions(id, title, expand, fns);
// Override focus() to prevent execution in EditorUi for an iframe:
* Override focus() to prevent execution in EditorUi for an iframe.
* We render our diagrams in an iframe and the library code in the EditorUi
* class calls focus() on its container right after the HTML elements for it are
* created. This makes the browser scroll to the last rendered diagram on the
* page, skipping previous diagrams or content. Below is a grotesque hack to
* prevent that call, without modifying the library code.
var oldHTMLFocus = HTMLElement.prototype.focus;
HTMLElement.prototype.focus = function () {
// Only prevent execution for this specific div:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment