Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, Optional, Self, Input, HostListener, Inject } from '@angular/core';
import { Directive, Optional, Self, Input, HostListener, Inject, HostBinding } from '@angular/core';
import { IGX_DROPDOWN_BASE } from './drop-down.common';
import { IDropDownNavigationDirective } from './drop-down.common';
import { IgxDropDownBaseDirective } from './drop-down.base';
Expand Down Expand Up @@ -53,6 +53,11 @@ export class IgxDropDownItemNavigationDirective implements IDropDownNavigationDi
this._target = target ? target : this.dropdown;
}

@HostBinding('attr.aria-activedescendant')
public get activeDescendant(): string {
return this._target?.activeDescendant;
}

/**
* Captures keydown events and calls the appropriate handlers on the target component
*/
Expand Down
10 changes: 10 additions & 0 deletions projects/igniteui-angular/src/lib/drop-down/drop-down.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ export abstract class IgxDropDownBaseDirective implements IDropDownList, OnInit
return this.element;
}

/**
* @hidden @internal
* Gets the id of the focused item during dropdown navigation.
* This is used to update the `aria-activedescendant` attribute of
* the IgxDropDownNavigationDirective host element.
*/
public get activeDescendant (): string {
return this.focusedItem ? this.focusedItem.id : null;
}

/**
* @hidden
* @internal
Expand Down
1 change: 1 addition & 0 deletions src/app/drop-down/drop-down.sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
>
@for(item of items; track item) {
<igx-drop-down-item
[ariaLabel]="item.field"
[disabled]="item.disabled"
[isHeader]="item.header"
>
Expand Down