Question

All form widgets extend from dijit.form._FormWidgetMixin which scrolls the window to the widget when it receives focus.

I personally find that this behavior makes most widgets unusable. How can I stop it?

Was it helpful?

Solution

Dojo allows you to extend base components using dojo/_base/lang::extend. Just make sure to require this module before any require calls that load dijit/form/_FormWidgetMixin

// Dojo 1.7+ (AMD)
define([
    "dojo/_base/lang",
    "dijit/form/_FormWidgetMixin"
], function(lang, _FormWidget){
    lang.extend(_FormWidget, {
        scrollOnFocus:false
    });
});

Here is the same for pre-AMD dojo:

// Dojo < 1.7
dojo.require("dijit.form._FormWidget");
dojo.extend(dijit.form._FormWidget, {
    scrollOnFocus:false
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top