                         if (obj is IFocusManagerGroup)
                         {
                             tg2 = IFocusManagerGroup(obj);
-                            if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj))
+                            if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj) &&
+                                tg2["document"] == tg1["document"])
                             {
                                 if (tg2.selected) 
                                 {

                    
                    if (tg1 != groupElementToFocus)
                    {
                        // cycle the entire focusable candidates array forward or backward,
                        // wrapping around boundaries, searching for our focus candidate
                        j = i;

                                    }
                                    else
                                    {
                                        // switch to new group and hunt for selected item
                                        tg1 = tg2;
                                        i = j;
                                        // element is part of another group, stop if selected
                                        if (tg2.selected)
                                            break;
                                        else
                                            foundAnotherGroup = true;
                                    }
                                }
                                else
