Project

General

Profile

issue_9.txt

Sergey Ivanovskiy, 05/22/2026 06:30 AM

Download (3.97 KB)

 
1
ISSUE DESCRIPTION:
2
*[MAJOR]* _functional_ @SsoReauth@.@handleSsoReauth@: @btnRelogin.focus()@ runs in @.then(...)@ of @reauthDialog.show()@, but the dijit Dialog is constructed with @autofocus: true@ and @refocus: true@ (p2j.js lines ~2001-2004). Dijit's autofocus uses a deferred focus pass that can run after the explicit @focus()@, fighting for and possibly cancelling focus on @btnRelogin@. Set @autofocus: false@ on the dojo Dialog when an explicit focus target is used, or move the focus call into the dojo @onShow@ hook.
3

    
4
PROPOSED FIX:
5
Add an optional @noAutofocus@ flag to the @ModalDialog@ constructor's @titleOption@ object (the existing options bag) and forward it as @autofocus: false@ to the dijit Dialog. Then in @p2j.sso_reauth.js@ pass @noAutofocus: true@ when constructing the dialog so dijit's deferred autofocus does not race the explicit @btnRelogin.focus()@.
6

    
7
CHANGES:
8
<file: src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js>
9

    
10
Before (lines 1925-1934):
11

    
12
   function ModalDialog(id, container, text, tooltip, hidden, titleOption)
13
   {
14
      var that = this;
15
      that.id = id;
16
      that.text = text;
17
      that.tooltip = tooltip;
18
      // if titleOption is omitted the title bar is displayed withot closed button
19
      that.noTitle = (titleOption && titleOption.noTitle) ? true : false;
20
      that.closable = (titleOption && titleOption.closable) ? true : false;
21

    
22
After:
23

    
24
   function ModalDialog(id, container, text, tooltip, hidden, titleOption)
25
   {
26
      var that = this;
27
      that.id = id;
28
      that.text = text;
29
      that.tooltip = tooltip;
30
      // if titleOption is omitted the title bar is displayed withot closed button
31
      that.noTitle = (titleOption && titleOption.noTitle) ? true : false;
32
      that.closable = (titleOption && titleOption.closable) ? true : false;
33
      // Opt-out of dijit's deferred autofocus when the caller drives focus.
34
      that.noAutofocus = (titleOption && titleOption.noAutofocus) ? true : false;
35

    
36
Before (lines 1994-2006):
37

    
38
               var dojoDialog = new Dialog(
39
                     {
40
                        id: that.id,
41
                        className: "dialogFWDOverride",
42
                        // It ensures screen readers announce the dialog content immediately
43
                        //  and allows users to start interacting with the dialog
44
                        //  without clicking it first
45
                        autofocus: true,
46
                        // This is essential for keyboard navigation, allowing users
47
                        // to resume their workflow seamlessly after dismissing a dialog.
48
                        refocus: true,
49
                        closable: that.closable,
50
                     });
51

    
52
After:
53

    
54
               var dojoDialog = new Dialog(
55
                     {
56
                        id: that.id,
57
                        className: "dialogFWDOverride",
58
                        // Callers driving their own focus target pass noAutofocus
59
                        // to avoid dijit's deferred autofocus racing the explicit focus().
60
                        autofocus: that.noAutofocus ? false : true,
61
                        // This is essential for keyboard navigation, allowing users
62
                        // to resume their workflow seamlessly after dismissing a dialog.
63
                        refocus: true,
64
                        closable: that.closable,
65
                     });
66

    
67
<file: src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sso_reauth.js>
68

    
69
Before (lines 150-152):
70

    
71
      // -- Create modal dialog for the re-auth overlay --
72
      reauthDialog = new p2j.ModalDialog('p2j-sso-reauth-dialog', document.body, '', '', true,
73
         {noTitle: true});
74

    
75
After:
76

    
77
      // -- Create modal dialog for the re-auth overlay --
78
      // noAutofocus: drive focus to btnRelogin ourselves after show() resolves
79
      // (dijit's deferred autofocus would otherwise race the explicit focus call).
80
      reauthDialog = new p2j.ModalDialog('p2j-sso-reauth-dialog', document.body, '', '', true,
81
         {noTitle: true, noAutofocus: true});