Skip to content

Commit

Permalink
fix(expansion-panel): remove invalid aria-expanded attribute set on…
Browse files Browse the repository at this point in the history
… header (#443)
  • Loading branch information
samrichardsontylertech authored Dec 14, 2023
1 parent 73824fd commit 2367af5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/lib/calendar/calendar-foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,8 @@ export class CalendarFoundation implements ICalendarFoundation {
private _applyMin(): void {
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.MIN, !!this._minAttribute, this._minAttribute as string);

if (this._min && this._min.getMonth() > this._month) {
if (this._min && (this._min.getMonth() > this._month || this._min.getFullYear() > this._year)) {
this._year = this._min.getFullYear();
this._month = this._min.getMonth();
}

Expand Down
6 changes: 0 additions & 6 deletions src/lib/expansion-panel/expansion-panel-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelComponent>
openIconElement.open = true;
}
}

this._headerElement.setAttribute('aria-expanded', open ? 'true' : 'false');
}

public setHeaderVisibility(visible: boolean): void {
Expand Down Expand Up @@ -125,7 +123,6 @@ export class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelComponent>
this._contentElement.style.height = `${this._contentElement.scrollHeight}px`;
}
this._contentElement.style.opacity = '1';
this._headerElement.setAttribute('aria-expanded', 'true');
if (openIconElement) {
openIconElement.open = true;
}
Expand All @@ -136,7 +133,6 @@ export class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelComponent>
this._contentElement.style.height = '0px';
}
this._contentElement.style.opacity = '0';
this._headerElement.setAttribute('aria-expanded', 'false');
if (openIconElement) {
openIconElement.open = false;
}
Expand All @@ -158,7 +154,6 @@ export class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelComponent>
}
this._contentElement.style.removeProperty('visibility');
this._contentElement.style.removeProperty('opacity');
this._headerElement.setAttribute('aria-expanded', 'true');
if (openIconElement) {
openIconElement.open = true;
}
Expand All @@ -170,7 +165,6 @@ export class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelComponent>
}
this._contentElement.style.opacity = '0';
this._contentElement.style.visibility = 'hidden';
this._headerElement.setAttribute('aria-expanded', 'false');
if (openIconElement) {
openIconElement.open = false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/spec/date-picker/date-picker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ describe('DatePickerComponent', function(this: ITestContext) {
openPopup(this.context.component);
const calendar = getCalendar(this.context.component);

expect(calendar.month).toEqual(date.getMonth() + 1);
const expectedMonth = date.getMonth() >= 11 ? 0 : date.getMonth() + 1;
expect(calendar.month).toEqual(expectedMonth);
});

it('should open calendar in month of max date if max is before current month', function(this: ITestContext) {
Expand Down

0 comments on commit 2367af5

Please sign in to comment.