Commit 2668aca1 authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

A11y: Extensions: Keep button in tab order to allow clearing shortcut.

Bug: 1031008
Change-Id: I4aece44c572589531cc34aae023ea62dc14f381f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1960183Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723539}
parent 9003a870
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
left: -2px; left: -2px;
right: inherit; right: inherit;
} }
/* Invisible so the element is still in the tab order. */
[invisible] {
opacity: 0;
}
</style> </style>
<div id="main"> <div id="main">
<cr-input id="input" placeholder="$i18n{shortcutTypeAShortcut}" <cr-input id="input" placeholder="$i18n{shortcutTypeAShortcut}"
...@@ -25,7 +30,8 @@ ...@@ -25,7 +30,8 @@
value="[[computeText_(capturing_, shortcut, pendingShortcut_)]]"> value="[[computeText_(capturing_, shortcut, pendingShortcut_)]]">
<cr-icon-button id="clear" aria-label="$i18nPolymer{clear}" <cr-icon-button id="clear" aria-label="$i18nPolymer{clear}"
slot="suffix" class="icon-cancel no-overlap" slot="suffix" class="icon-cancel no-overlap"
hidden$="[[computeClearHidden_(capturing_, shortcut)]]" invisible$="[[computeClearInvisible_(capturing_, shortcut)]]"
hidden$="[[computeClearHidden_(shortcut)]]"
on-click="onClearTap_"></cr-icon-button> on-click="onClearTap_"></cr-icon-button>
</cr-input> </cr-input>
</div> </div>
...@@ -235,13 +235,21 @@ Polymer({ ...@@ -235,13 +235,21 @@ Polymer({
}, },
/** /**
* Invisible when capturing AND we have a shortcut.
* @return {boolean} Whether the clear button is invisible.
* @private
*/
computeClearInvisible_: function() {
return this.capturing_ && !!this.shortcut;
},
/**
* Hidden when no shortcut is set.
* @return {boolean} Whether the clear button is hidden. * @return {boolean} Whether the clear button is hidden.
* @private * @private
*/ */
computeClearHidden_: function() { computeClearHidden_: function() {
// We don't want to show the clear button if the input is currently return !this.shortcut;
// capturing a new shortcut or if there is no shortcut to clear.
return this.capturing_ || !this.shortcut;
}, },
/** /**
......
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