1414
1515import { backgroundColor , bodyFontFamily , labelColor , labelStyleChunk } from './styles' ;
1616import { html } from '@polymer/lit-element' ;
17- import { SelectableElement , AbstractSelectLitElement } from './abstract-select' ;
17+ import { SelectableElement , AbstractSelectElement , SelectProperties } from './abstract-select' ;
1818import { property } from './decorators' ;
1919
2020
@@ -37,33 +37,22 @@ interface UIElements {
3737 * Creates a UI element for selecting an appropriate input method,
3838 * bundles proper initialization, event bubbling, access to calibration
3939 * and messaging.
40- * @extends AbstractSelectLitElement
40+ * @extends AbstractSelectElement
4141 */
42- export class InputModeSelectElement extends AbstractSelectLitElement {
42+ export class InputModeSelectElement extends AbstractSelectElement {
4343
4444 /**
4545 * provide a selector for the content element the input is applied to
4646 */
4747 @property ( { type : String } )
4848 public contentSelector :string = 'body' ; //'acc-content';
4949
50-
51- @property ( { type : String } )
52- public label :string = '' ;
53-
5450 constructor ( ) {
5551 super ( ) ;
5652 this . _nodeChildSelector = '*' ;
53+ this . label = this . label || 'Tracking' ;
5754 }
5855
59- // focus() {
60- // super.focus();
61- // const select = this.shadowRoot.querySelector('select');
62- // if(select) {
63- // select.focus();
64- // }
65- // }
66-
6756
6857 set contentElement ( element : HTMLElement | null ) {
6958 this . items . forEach ( item => {
@@ -131,7 +120,7 @@ export class InputModeSelectElement extends AbstractSelectLitElement {
131120 super . _addNode ( node ) ;
132121 }
133122
134- _render ( { label} : UIElements ) {
123+ _render ( { label, hideLabel } : SelectProperties ) {
135124 const sI = this . selectedIndex ;
136125 const hasControls = this . selected && this . selected . hasControls ;
137126
@@ -213,9 +202,9 @@ export class InputModeSelectElement extends AbstractSelectLitElement {
213202 }
214203
215204 </ style >
216- < label for ="select "> Tracking </ label >
205+ ${ hideLabel ? '' : html ` < label for ="select "> ${ label } </ label > ` }
217206 < div class ="select-style ">
218- < select class ="accessibility-selector " on-input ="${ onSelectInput } " id ="select ">
207+ < select class ="accessibility-selector " on-input ="${ onSelectInput } " id ="select " aria-label$ =" ${ label } " >
219208 ${ this . items . map ( ( node , i ) => {
220209 const isSelected = i === sI ;
221210 return html `< option value ="${ node . inputType } " selected ="${ isSelected } "> ${ node . label } </ option > ` ;
0 commit comments