Commit ed5cd360 authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

[CCA WebUI] Add closure compile to nav.js.

Bug: 980846
Change-Id: I143a064686771bc1fe8a14ed5258208ba77ece13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720429Reviewed-by: default avatarKuo Jen Wei <inker@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682141}
parent b547c9ad
...@@ -11,13 +11,16 @@ group("closure_compile") { ...@@ -11,13 +11,16 @@ group("closure_compile") {
"device:closure_compile", "device:closure_compile",
"models:closure_compile", "models:closure_compile",
"mojo:closure_compile", "mojo:closure_compile",
"views:closure_compile",
] ]
} }
js_type_check("compile_resources") { js_type_check("compile_resources") {
deps = [ deps = [
":nav",
":resolution_event_broker", ":resolution_event_broker",
":state", ":state",
":toast",
":tooltip", ":tooltip",
":util", ":util",
] ]
...@@ -26,9 +29,21 @@ js_type_check("compile_resources") { ...@@ -26,9 +29,21 @@ js_type_check("compile_resources") {
js_library("resolution_event_broker") { js_library("resolution_event_broker") {
} }
js_library("nav") {
deps = [
"views:view",
]
}
js_library("state") { js_library("state") {
} }
js_library("toast") {
deps = [
":util",
]
}
js_library("tooltip") { js_library("tooltip") {
} }
......
...@@ -34,8 +34,10 @@ cca.nav.topmostIndex_ = -1; ...@@ -34,8 +34,10 @@ cca.nav.topmostIndex_ = -1;
cca.nav.setup = function(views) { cca.nav.setup = function(views) {
cca.nav.views_ = views; cca.nav.views_ = views;
// Manage all tabindex usages in cca.nav for navigation. // Manage all tabindex usages in cca.nav for navigation.
document.querySelectorAll('[tabindex]').forEach( document.querySelectorAll('[tabindex]')
(element) => cca.util.makeUnfocusableByMouse(element)); .forEach(
(element) => cca.util.makeUnfocusableByMouse(
/** @type {!HTMLElement} */ (element)));
}; };
/** /**
......
...@@ -39,7 +39,7 @@ cca.toast.speak = function(message) { ...@@ -39,7 +39,7 @@ cca.toast.speak = function(message) {
cca.toast.update_ = function(message, spoken) { cca.toast.update_ = function(message, spoken) {
// TTS speaks changes of on-screen aria-live elements. Force content changes // TTS speaks changes of on-screen aria-live elements. Force content changes
// and clear content once inactive to avoid stale content being read out. // and clear content once inactive to avoid stale content being read out.
var element = document.querySelector('#toast'); var element = /** @type {!HTMLElement} */ (document.querySelector('#toast'));
cca.util.animateCancel(element); // Cancel the active toast if any. cca.util.animateCancel(element); // Cancel the active toast if any.
element.textContent = ''; // Force to reiterate repeated messages. element.textContent = ''; // Force to reiterate repeated messages.
element.textContent = chrome.i18n.getMessage(message) || message; element.textContent = chrome.i18n.getMessage(message) || message;
......
# 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("//third_party/closure_compiler/compile_js.gni")
group("closure_compile") {
deps = [
":compile_resources",
]
}
js_type_check("compile_resources") {
deps = [
":view",
]
}
js_library("view") {
deps = [
"..:toast",
]
}
...@@ -21,12 +21,14 @@ cca.views = cca.views || {}; ...@@ -21,12 +21,14 @@ cca.views = cca.views || {};
* @param {boolean=} dismissByBkgndClick Enable dismissible by background-click. * @param {boolean=} dismissByBkgndClick Enable dismissible by background-click.
* @constructor * @constructor
*/ */
cca.views.View = function(selector, dismissByEsc, dismissByBkgndClick) { cca.views.View = function(
selector, dismissByEsc = false, dismissByBkgndClick = false) {
/** /**
* @type {HTMLElement} * @type {!HTMLElement}
* @private * @private
*/ */
this.rootElement_ = document.querySelector(selector); this.rootElement_ =
/** @type {!HTMLElement} */ (document.querySelector(selector));
/** /**
* @type {Promise<*>} * @type {Promise<*>}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment