Univention Bugzilla – Bug 45511
The dialog when adding new UDM objects is not automatically focused
Last modified: 2020-06-22 16:57:53 CEST
The dialog when adding new UDM objects is not automatically focused. The first widget in the dialog should be focused. The 'Add' button is focused instead. Pressing enter to continue the object creation wizard opens a new dialog.
Created attachment 9247 [details] patch
The patch removes a comment with the reason why autoFocus was set to false "interferes with Wizard.autoFocus". Can you make a comment about this? Is this not the case anymore?
dijit/Dialog sets the domStyle on creation to 'display: none'. When the dialog is being shown the 'display: none' is removed. The autoFocus code of the Wizard (when it tries to focus the first widget) is called before 'display: none' is removed and therefore does nothing. There are a couple of ways to get around this (and probably more) 1. Prevent the dialog to set display: none Destroys styling (looks a little bit weird when the dialog fades in) 2. Focus the first widget when the dialog fade in is finished Patch in NewObjectDialog.js: ... this.own(aspect.after(this, 'show', function(promise) { promise.then(lang.hitch(this, function() { var currentWizard = this._wizardContainer.selectedChildWidget; var currentPageInWizard = currentWizard.selectedChildWidget; currentWizard.focusFirstWidget(currentPageInWizard.name); })); return promise; })); ... 3. let the dialog autofocus handle it (which is also done on the end of the fadein) This is the attached patch. Code in dijit/Dialog ... if(this.autofocus && DialogLevelManager.isTop(this)){ this._getFocusItems(); focus.focus(this._firstFocusItem); } ... The native dijit/Dialog autofocus does not interfere as far as i see it.