Skip to content

Commit 5d6eae4

Browse files
Fixed DropdownServerSide aria-expanded attribute logic
1 parent 9907ecf commit 5d6eae4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/scripts/OSFramework/OSUI/Pattern/Dropdown/ServerSide/DropdownServerSide.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide {
66
OSUIDropdownServerSideConfig,
77
Patterns.DropdownServerSideItem.IDropdownServerSideItem
88
>
9-
implements IDropdownServerSide {
9+
implements IDropdownServerSide
10+
{
1011
// Store the HTML element for the DropdownBalloonContainer
1112
private _balloonContainerElement: HTMLElement;
1213
// Store the Balloon Element
@@ -601,6 +602,9 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide {
601602

602603
// Method that will update the pattern state
603604
private _updatePatternState(): void {
605+
// Update selected wrapper acesssibility attributes
606+
this._updateSelectedWrappeAccessibilityElement();
607+
604608
// Update the TabIndex for the items inside Balloon
605609
this._updateBalloonAccessibilityElements();
606610

@@ -630,13 +634,25 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide {
630634
this._triggerToogleCalbackEvent();
631635
}
632636

637+
private _updateSelectedWrappeAccessibilityElement() {
638+
if (this._isOpen) {
639+
// Set the aria-expanded atribute as true
640+
Helper.A11Y.AriaExpandedTrue(this._selectValuesWrapper);
641+
} else {
642+
// Set the aria-expanded atribute as false
643+
Helper.A11Y.AriaExpandedFalse(this._selectValuesWrapper);
644+
}
645+
}
646+
633647
/**
634648
* Add the Accessibility Attributes values
635649
*
636650
* @protected
637651
* @memberof OSFramework.Patterns.Dropdown.ServerSide.OSUIDropdownServerSide
638652
*/
639653
protected setA11YProperties(): void {
654+
// Update selected wrapper acesssibility attributes
655+
this._updateSelectedWrappeAccessibilityElement();
640656
// Update Tabindex Ballon elements
641657
this._updateBalloonAccessibilityElements();
642658

0 commit comments

Comments
 (0)