META-INF.dirigible.dev-tools.ui.utils.focus-changed.js Maven / Gradle / Ivy
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {Widget} from '../Widget.js';
import {XWidget} from '../XWidget.js';
/**
* @param {!Event} event
*/
export function focusChanged(event) {
const document = event.target && event.target.ownerDocument;
const element = document ? document.deepActiveElement() : null;
Widget.focusWidgetForNode(element);
XWidget.focusWidgetForNode(element);
if (!UI._keyboardFocus) {
return;
}
UI.markAsFocusedByKeyboard(element);
}