Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(expansion-panel): remove invalid aria-expanded attribute set on header #443

Merged
merged 3 commits into from
Dec 14, 2023
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
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