@@ -58,17 +58,6 @@ export class UUIComboboxElement extends FormControlMixin(LitElement) {
58
58
box-shadow: var(--uui-shadow-depth-3);
59
59
}
60
60
61
- #clear-button {
62
- pointer-events: none;
63
- opacity: 0;
64
- transition: opacity 120ms;
65
- }
66
-
67
- #clear-button.--show {
68
- pointer-events: auto;
69
- opacity: 1;
70
- }
71
-
72
61
#caret {
73
62
margin-right: var(--uui-size-3, 9px);
74
63
display: flex;
@@ -182,9 +171,10 @@ export class UUIComboboxElement extends FormControlMixin(LitElement) {
182
171
}
183
172
184
173
private _onMouseDown = ( ) => requestAnimationFrame ( ( ) => this . _input . focus ( ) ) ;
174
+
185
175
private _onBlur = ( ) =>
186
176
requestAnimationFrame ( ( ) => {
187
- if ( document . activeElement !== this ) {
177
+ if ( ! this . shadowRoot ?. activeElement ) {
188
178
this . _onClose ( ) ;
189
179
}
190
180
} ) ;
@@ -250,6 +240,8 @@ export class UUIComboboxElement extends FormControlMixin(LitElement) {
250
240
// Reset input(search-input) value:
251
241
this . _input . value = this . _displayValue ;
252
242
243
+ this . _input . focus ( ) ;
244
+
253
245
this . dispatchEvent ( new UUIComboboxEvent ( UUIComboboxEvent . SEARCH ) ) ;
254
246
this . dispatchEvent ( new UUIComboboxEvent ( UUIComboboxEvent . CHANGE ) ) ;
255
247
} ;
@@ -278,22 +270,23 @@ export class UUIComboboxElement extends FormControlMixin(LitElement) {
278
270
} ;
279
271
280
272
private _renderClearButton = ( ) => {
281
- return html `< uui-button
282
- id ="clear-button "
283
- class =${ this . value || this . search ? '--show' : '' }
284
- @click =${ this . _onClear }
285
- @keydown=${ this . _onClear }
286
- label="clear"
287
- slot="append"
288
- compact
289
- style="height: 100%;">
290
- < uui-icon name ="remove " .fallback =${ iconRemove . strings [ 0 ] } > </ uui-icon >
291
- </ uui-button > ` ;
273
+ return this . value || this . search
274
+ ? html `< uui-button
275
+ id ="clear-button "
276
+ @click =${ this . _onClear }
277
+ @keydown =${ this . _onClear }
278
+ label="clear"
279
+ slot="append"
280
+ compact
281
+ style="height: 100%;">
282
+ < uui-icon name ="remove " .fallback =${ iconRemove . strings [ 0 ] } > </ uui-icon >
283
+ </ uui-button > `
284
+ : '' ;
292
285
} ;
293
286
294
287
private _renderDropdown = ( ) => {
295
288
return html `< div id ="dropdown " slot ="popover ">
296
- < uui-scroll-container id ="scroll-container ">
289
+ < uui-scroll-container tabindex =" -1 " id ="scroll-container ">
297
290
< slot > </ slot >
298
291
</ uui-scroll-container >
299
292
</ div > ` ;
0 commit comments