@@ -56,10 +56,13 @@ export const SelectableMixin = <T extends Constructor<LitElement>>(
5656 this . _selectable = newVal ;
5757
5858 // Potentially problematic as a component might need focus for another feature when not selectable:
59- //if (this.#selectableTarget === this) {
60- // If the selectable target, then make it self selectable. (A different selectable target should be made focusable by the component itself)
61- this . #selectableTarget. setAttribute ( 'tabindex' , `${ newVal ? '0' : '-1' } ` ) ;
62- //}
59+ if ( this . #selectableTarget === this ) {
60+ // If the selectable target, then make it self selectable. (A different selectable target should be made focusable by the component itself)
61+ this . #selectableTarget. setAttribute (
62+ 'tabindex' ,
63+ `${ newVal ? '0' : '-1' } ` ,
64+ ) ;
65+ }
6366 this . requestUpdate ( 'selectable' , oldVal ) ;
6467 }
6568
@@ -88,10 +91,13 @@ export const SelectableMixin = <T extends Constructor<LitElement>>(
8891 ) ;
8992
9093 this . #selectableTarget = target as Element ;
91- this . #selectableTarget. setAttribute (
92- 'tabindex' ,
93- this . _selectable ? '0' : '-1' ,
94- ) ;
94+ if ( this . #selectableTarget === this ) {
95+ // If the selectable target, then make it self selectable. (A different selectable target should be made focusable by the component itself)
96+ this . #selectableTarget. setAttribute (
97+ 'tabindex' ,
98+ this . _selectable ? '0' : '-1' ,
99+ ) ;
100+ }
95101 target . addEventListener ( 'click' , this . #onClick) ;
96102 target . addEventListener ( 'keydown' , this . #onKeydown as EventListener ) ;
97103 }
0 commit comments