Bug 45511 - The dialog when adding new UDM objects is not automatically focused
The dialog when adding new UDM objects is not automatically focused
Status: NEW
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-10-12 16:27 CEST by Johannes Keiser
Modified: 2020-06-22 16:57 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: 4: Will affect most installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.046
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
keiser: Patch_Available+


Attachments
patch (577 bytes, patch)
2017-10-12 16:27 CEST, Johannes Keiser
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Keiser univentionstaff 2017-10-12 16:27:01 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.
Comment 1 Johannes Keiser univentionstaff 2017-10-12 16:27:46 CEST
Created attachment 9247 [details]
patch
Comment 2 Florian Best univentionstaff 2017-10-16 16:00:38 CEST
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?
Comment 3 Johannes Keiser univentionstaff 2017-10-17 17:26:23 CEST
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.