Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/third_party/closure/goog/ui/toolbar.js
4515 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview A toolbar class that hosts {@link goog.ui.Control}s such as
9
* buttons and menus, along with toolbar-specific renderers of those controls.
10
*
11
* @see ../demos/toolbar.html
12
*/
13
14
goog.provide('goog.ui.Toolbar');
15
16
goog.require('goog.ui.Container');
17
goog.require('goog.ui.ToolbarRenderer');
18
goog.requireType('goog.dom.DomHelper');
19
20
21
22
/**
23
* A toolbar class, implemented as a {@link goog.ui.Container} that defaults to
24
* having a horizontal orientation and {@link goog.ui.ToolbarRenderer} as its
25
* renderer.
26
* @param {goog.ui.ToolbarRenderer=} opt_renderer Renderer used to render or
27
* decorate the toolbar; defaults to {@link goog.ui.ToolbarRenderer}.
28
* @param {?goog.ui.Container.Orientation=} opt_orientation Toolbar orientation;
29
* defaults to `HORIZONTAL`.
30
* @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper.
31
* @constructor
32
* @extends {goog.ui.Container}
33
*/
34
goog.ui.Toolbar = function(opt_renderer, opt_orientation, opt_domHelper) {
35
'use strict';
36
goog.ui.Container.call(
37
this, opt_orientation,
38
opt_renderer || goog.ui.ToolbarRenderer.getInstance(), opt_domHelper);
39
};
40
goog.inherits(goog.ui.Toolbar, goog.ui.Container);
41
42
43
/** @override */
44
goog.ui.Toolbar.prototype.handleFocus = function(e) {
45
'use strict';
46
goog.ui.Toolbar.base(this, 'handleFocus', e);
47
// Highlight the first highlightable item on focus via the keyboard for ARIA
48
// spec compliance. Do not highlight the item if the mouse button is pressed,
49
// since this method is also called from handleMouseDown when a toolbar button
50
// is clicked.
51
if (!this.isMouseButtonPressed()) {
52
this.highlightFirst();
53
}
54
};
55
56