Files
gerrit/polygerrit-ui/app/elements/shared/gr-button/gr-button.html
Becky Siegel f0ebfdcfc5 Disallow tabbing on paper-button
Because you can already tab through gr-buttons, the paper-button made it
so that each button had two tabs. The tabindex should only be on the
gr-buttons, so disallow on paper-button. For easy demonstration of this
issue, try to tab through the labels on the reply dilog.

Change-Id: Ibc1e7d753f3cda1786d09f81433656c9d3282305
(cherry picked from commit 048e8dc960)
2018-02-06 16:45:26 +00:00

125 lines
4.1 KiB
HTML

<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../behaviors/gr-tooltip-behavior/gr-tooltip-behavior.html">
<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
<link rel="import" href="../../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../../styles/shared-styles.html">
<dom-module id="gr-button">
<template strip-whitespace>
<style include="shared-styles">
:host {
display: inline-block;
font-family: var(--font-family-bold);
font-size: 12px;
position: relative;
}
:host([hidden]) {
display: none;
}
:host([link]) {
background-color: transparent;
border: none;
color: var(--color-link);
font-size: inherit;
font-family: var(--font-family-bold);
text-transform: none;
}
:host([link]) paper-button {
margin: 0;
padding: 0;
@apply --gr-button;
}
paper-button[raised] {
background-color: var(--gr-button-background, #fff);
color: var(--gr-button-color, --color-link);
}
:host([no-uppercase]) paper-button {
text-transform: none;
}
/* todo (beckysiegel) switch all secondary to primary as there is no color
distinction anymore. */
:host([primary]) paper-button[raised],
:host([secondary]) paper-button[raised] {
background-color: var(--color-link);
color: #fff;
}
:host([primary][disabled]) paper-button[raised],
:host([disabled]) paper-button {
opacity: .5;
}
:host([link]) paper-button:hover,
:host([link]) paper-button:focus,
paper-button[raised]:hover,
paper-button[raised]:focus {
color: var(--gr-button-hover-color, --color-button-hover);
}
:host([primary]) paper-button[raised]:hover,
:host([primary]) paper-button[raised]:focus,
:host([secondary]) paper-button[raised]:hover,
:host([secondary]) paper-button[raised]:focus {
background-color: var(--gr-button-hover-background-color, --color-button-hover);
color: var(--gr-button-color, #fff);
}
paper-button,
paper-button[raised],
paper-button[link] {
display: flex;
align-items: center;
justify-content: center;
margin: 0;
min-width: 0;
padding: .4em .85em;
@apply --gr-button;
}
:host([link]) paper-button {
--paper-button: {
padding: 0;
}
}
:host:not([down-arrow]) .downArrow {display: none; }
:host([down-arrow]) .downArrow {
border-top: .36em solid var(--gr-button-arrow-color, #ccc);
border-left: .36em solid transparent;
border-right: .36em solid transparent;
margin-bottom: .05em;
margin-left: .5em;
transition: border-top-color 200ms;
}
:host([down-arrow]) paper-button:hover .downArrow {
border-top-color: var(--gr-button-arrow-hover-color, #666);
}
:host([loading]) paper-button,
:host([disabled]) paper-button {
color: #aaa;
}
:host([loading]) paper-button,
:host([loading][disabled]) paper-button {
cursor: wait;
background-color: #efefef;
color: #aaa;
}
</style>
<paper-button raised="[[!link]]" disabled="[[disabled]]" tabindex="-1">
<content></content>
<i class="downArrow"></i>
</paper-button>
</template>
<script src="gr-button.js"></script>
</dom-module>