@@ -124,10 +124,10 @@ export class Chips extends Component<ChipsOptions> {
124124 this . chipsData = this . options . data ;
125125 this . _renderChips ( ) ;
126126 }
127- this . _setupLabel ( ) ;
128127
129128 // Render input element, setup event handlers
130129 if ( this . options . allowUserInput ) {
130+ this . _setupLabel ( ) ;
131131 this . el . classList . add ( 'input-field' ) ;
132132 this . _setupInput ( ) ;
133133 this . _setupEventHandlers ( ) ;
@@ -299,9 +299,9 @@ export class Chips extends Component<ChipsOptions> {
299299 }
300300 } ;
301301
302- _renderChip ( chip : ChipData ) : HTMLDivElement {
302+ _renderChip ( chip : ChipData ) : HTMLLIElement {
303303 if ( ! chip . id ) return ;
304- const renderedChip = document . createElement ( 'div ' ) ;
304+ const renderedChip = document . createElement ( 'li ' ) ;
305305 renderedChip . classList . add ( 'chip' ) ;
306306 renderedChip . innerText = chip . text || < string > chip . id ;
307307 // attach image if needed
@@ -311,11 +311,10 @@ export class Chips extends Component<ChipsOptions> {
311311 renderedChip . insertBefore ( img , renderedChip . firstChild ) ;
312312 }
313313 if ( this . options . allowUserInput ) {
314- renderedChip . setAttribute ( 'tabindex' , '0' ) ;
315- const closeIcon = document . createElement ( 'i' ) ;
316- closeIcon . classList . add ( this . options . closeIconClass , 'close' ) ;
317- closeIcon . innerText = 'close' ;
318- renderedChip . appendChild ( closeIcon ) ;
314+ const closeButton = document . createElement ( 'button' ) ;
315+ closeButton . classList . add ( this . options . closeIconClass , 'close' ) ;
316+ closeButton . innerText = 'close' ;
317+ renderedChip . appendChild ( closeButton ) ;
319318 }
320319 return renderedChip ;
321320 }
0 commit comments