@@ -182,17 +182,17 @@ class Trait<T> implements ISpliceable<boolean>, IDisposable {
182182
183183class FocusTrait < T > extends Trait < T > {
184184
185- constructor ( ) {
185+ constructor ( private isAriaSelected : ( index : number ) => boolean ) {
186186 super ( 'focused' ) ;
187187 }
188188
189189 renderIndex ( index : number , container : HTMLElement ) : void {
190190 super . renderIndex ( index , container ) ;
191191
192- if ( this . contains ( index ) ) {
192+ if ( this . contains ( index ) || this . isAriaSelected ( index ) ) {
193193 container . setAttribute ( 'aria-selected' , 'true' ) ;
194194 } else {
195- container . removeAttribute ( 'aria-selected' ) ;
195+ container . setAttribute ( 'aria-selected' , 'false ') ;
196196 }
197197 }
198198}
@@ -1198,8 +1198,8 @@ export class List<T> implements ISpliceable<T>, IDisposable {
11981198 renderers : IListRenderer < any /* TODO@joao */ , any > [ ] ,
11991199 private _options : IListOptions < T > = DefaultOptions
12001200 ) {
1201- this . focus = new FocusTrait ( ) ;
12021201 this . selection = new Trait ( 'selected' ) ;
1202+ this . focus = new FocusTrait ( this . selection . contains ) ;
12031203
12041204 mixin ( _options , defaultStyles , false ) ;
12051205
@@ -1272,6 +1272,9 @@ export class List<T> implements ISpliceable<T>, IDisposable {
12721272 if ( _options . ariaLabel ) {
12731273 this . view . domNode . setAttribute ( 'aria-label' , localize ( 'aria list' , "{0}. Use the navigation keys to navigate." , _options . ariaLabel ) ) ;
12741274 }
1275+ if ( _options . multipleSelectionSupport ) {
1276+ this . view . domNode . setAttribute ( 'aria-multiselectable' , 'true' ) ;
1277+ }
12751278 }
12761279
12771280 protected createMouseController ( options : IListOptions < T > ) : MouseController < T > {
0 commit comments