diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 5ebeb9bd88e..236df089187 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -677,21 +677,6 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent, } // Focus was on or inside of a popup that's being hidden FireCurrentFocusEvent(); - return NS_OK; - } - - if (aTargetNode == mDOMNode && mDOMNode != gLastFocusedNode && eventType.EqualsLiteral("focus")) { - // Got focus event for the window, we will make sure that an accessible - // focus event for initial focus is fired. We do this on a short timer - // because the initial focus may not have been set yet. - if (!mFireFocusTimer) { - mFireFocusTimer = do_CreateInstance("@mozilla.org/timer;1"); - } - if (mFireFocusTimer) { - mFireFocusTimer->InitWithFuncCallback(FireFocusCallback, this, - 0, nsITimer::TYPE_ONE_SHOT); - } - return NS_OK; } nsCOMPtr accessible; @@ -823,6 +808,19 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent, else #endif if (eventType.EqualsLiteral("focus")) { + if (aTargetNode == mDOMNode && mDOMNode != gLastFocusedNode) { + // Got focus event for the window, we will make sure that an accessible + // focus event for initial focus is fired. We do this on a short timer + // because the initial focus may not have been set yet. + if (!mFireFocusTimer) { + mFireFocusTimer = do_CreateInstance("@mozilla.org/timer;1"); + } + if (mFireFocusTimer) { + mFireFocusTimer->InitWithFuncCallback(FireFocusCallback, this, + 0, nsITimer::TYPE_ONE_SHOT); + } + } + // Keep a reference to the target node. We might want to change // it to the individual radio button or selected item, and send // the focus event to that. diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index d10efc42f1a..26a55087c36 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -4629,6 +4629,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = DispatchFocus(NS_ACTIVATE, PR_TRUE); } +#ifdef ACCESSIBILITY + if (nsWindow::gIsAccessibilityOn) { + // Create it for the first time so that it can start firing events + nsCOMPtr rootAccessible = GetRootAccessible(); + } +#endif + #ifdef WINCE // On Windows CE, we have a window that overlaps // the ISP button. In this case, we should always