fix: do not allow the window to grab focus when tabbing / shift+tabbing (#16042)
* fix: do not allow the window to grab focus when tabbing / shift+tabbing * test: add tests.
This commit is contained in:
parent
ed3e5739dc
commit
9c783f53ba
5 changed files with 171 additions and 0 deletions
|
@ -346,6 +346,19 @@ blink::WebSecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
|
|||
security_style_explanations);
|
||||
}
|
||||
|
||||
bool CommonWebContentsDelegate::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (source && source->GetOutermostWebContents() == source) {
|
||||
// If this is the outermost web contents and the user has tabbed or
|
||||
// shift + tabbed through all the elements, reset the focus back to
|
||||
// the first or last element so that it doesn't stay in the body.
|
||||
source->FocusThroughTabTraversal(reverse);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CommonWebContentsDelegate::DevToolsSaveToFile(const std::string& url,
|
||||
const std::string& content,
|
||||
bool save_as) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue