Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index 45e333d40163e98382cb41ec151153ddfe6c8ff5..bf2b95e0408db647b7e7d066a198b806ccdb6ef0 100644 |
--- a/Source/core/frame/FrameView.cpp |
+++ b/Source/core/frame/FrameView.cpp |
@@ -1362,7 +1362,8 @@ bool FrameView::scrollToAnchor(const String& name) |
maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document()); |
// If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation. |
- if (anchorNode && anchorNode->isFocusable()) |
+ // If anchorNode is not focusable, setFocusedElement() will still clear focus, which matches the behavior of other browsers. |
+ if (anchorNode) |
m_frame->document()->setFocusedElement(anchorNode); |
return true; |