IE7 problem when using popups

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alejandro
    New Member
    • Mar 2007
    • 27

    #16
    thanks for the link.
    I will now join Clint by saying SCREW IE 7!!!

    Comment

    • alejandro
      New Member
      • Mar 2007
      • 27

      #17
      Internet Explorer 7 handle of focus()

      Ok ok ok, I know I've bothered all of you with this same issue, but I'm still angry at IE7's handle of focus()....

      In any browser, if you call the focus() function to a given element in a given window; if the window is in the background, it will remain in the background until the user selects it. When selected (or alt+tabbed), the focus will be in the desired element. In IE7, however, giving focus to an element inside a window will also give focus to the window itself.

      Has anyone had to deal with this issue? Seems odd I can't find anything on this topic anywhere. Is there a well-known workaround I'm not aware of?

      Comment

      • Logician
        New Member
        • Feb 2007
        • 210

        #18
        Originally posted by alejandro
        In any browser, if you call the focus() function to a given element in a given window; if the window is in the background, it will remain in the background until the user selects it. When selected (or alt+tabbed), the focus will be in the desired element. In IE7, however, giving focus to an element inside a window will also give focus to the window itself.
        If you mean a form element, its window must be focused in order to enter data into it. Why do you want to focus an element if it's not to receive user input?

        Comment

        • alejandro
          New Member
          • Mar 2007
          • 27

          #19
          It doesn't have to be a form, calling focus() for any element inside the window will cause the window to come on top.
          In the project I'm working, if a user has focus on a certain element inside the window and then clicks a link that results in a popup (taking the focus from the original element), the popup is opened and the focus is given back to the element where the user had focus.
          So, if the user selects the window again, or closes the popup, the focus is back where he had left it.
          In IE7, doing this causes the window to come on top of the popup.
          Also, if the popup modifies what should appear on the main window (main window contains current sales orders and the popup is used to add a new one, for example), the main window is refreshed to keep the data up to date. If the main window happens to contain a focus() call in it's onload event (and most of them do, usually setting focus to a certain list so it can be browsed with the arrow keys), the window will come on top of the popup, only in IE7.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #20
            I've merged the threads because they are both on the same topic.

            Comment

            • alejandro
              New Member
              • Mar 2007
              • 27

              #21
              you're right, it's the same thing :P
              I just noticed that it's more annoying than I thought, as any window that finishes loading will steal the focus from any other active window (word document, google Earth, or whatever you were using while the window loads.).
              The only problem is that "Logician" won't find the post now and I won't be able to read his witty remarks :P

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #22
                Maybe you can file a bug with Microsoft, but don't hold your breath - it could take 5 years to fix!

                Logician should be able to find this thread from his subscribed threads list.

                Comment

                • alejandro
                  New Member
                  • Mar 2007
                  • 27

                  #23
                  Originally posted by acoder
                  Maybe you can file a bug with Microsoft, but don't hold your breath - it could take 5 years to fix!

                  Logician should be able to find this thread from his subscribed threads list.
                  Thank you very much for all your help acoder.
                  I worked around the issue by keeping track of the active window in IE7 and only setting focus to an element within a window if the window itself has focus.

                  I've found complaints about this IE behavior as old as Feb 2006 so I don't think they'll do anything about it anytime soon (heck, I'm not sure they'd even consider it a bug, they probably love having IE7 windows jumping on top of your Open Office documents :P )

                  Comment

                  Working...