Ensure that the correct initial focusable area is focused when tabbing
[WebKit-https.git] / WebKit2 / UIProcess / API / mac / WKView.mm
index b09951d503f04181c4010e8be2293c9bed0c2a66..02b7c67ada0a588f323abe3384cd7beb5f7d7481 100644 (file)
@@ -208,7 +208,13 @@ typedef HashMap<String, ValidationVector> ValidationMap;
 
 - (BOOL)becomeFirstResponder
 {
+    NSSelectionDirection direction = [[self window] keyViewSelectionDirection];
+
     _data->_page->setFocused(true);
+
+    if (direction != NSDirectSelection)
+        _data->_page->setInitialFocus(direction == NSSelectingNext);
+
     return YES;
 }