diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index fe5488055ace..73792021b3ac 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -3131,8 +3131,38 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, if (mCurrentTarget) { mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(newFocus)); const nsStyleUserInterface* ui = mCurrentTarget->StyleUserInterface(); - suppressBlur = (ui->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE); activeContent = mCurrentTarget->GetContent(); + + // In some cases, we do not want to even blur the current focused + // element. Those cases are: + // 1. -moz-user-focus CSS property is set to 'ignore'; + // 2. Element with NS_EVENT_STATE_DISABLED + // (aka :disabled pseudo-class for HTML element); + // 3. XUL control element has the disabled property set to 'true'. + // + // We can't use nsIFrame::IsFocusable() because we want to blur when + // we click on a visibility: none element. + // We can't use nsIContent::IsFocusable() because we want to blur when + // we click on a non-focusable element like a
+ ++ + diff --git a/dom/tests/mochitest/chrome/child_focus_frame.html b/dom/tests/mochitest/chrome/child_focus_frame.html index 89f2a8179647..d7f0ff63cda0 100644 --- a/dom/tests/mochitest/chrome/child_focus_frame.html +++ b/dom/tests/mochitest/chrome/child_focus_frame.html @@ -18,7 +18,7 @@