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
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Gate calendar month, year, and today keydowns for only ENTER as onClick handles space with button nodes to fix double date change regression.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class Calendar extends BaseComponent<ICalendarProps, ICalendarState> impl
}

private _onGotoTodayKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {
if (ev.which === KeyCodes.enter || ev.which === KeyCodes.space) {
if (ev.which === KeyCodes.enter) {
ev.preventDefault();
this._onGotoToday();
} else if (ev.which === KeyCodes.tab && !ev.shiftKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,15 @@ export class CalendarDay extends BaseComponent<ICalendarDayProps, ICalendarDaySt
}

private _onPrevMonthKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {
this._onKeyDown(this._onSelectPrevMonth, ev);
if (ev.which === KeyCodes.enter) {
this._onKeyDown(this._onSelectPrevMonth, ev);
}
}

private _onNextMonthKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {
this._onKeyDown(this._onSelectNextMonth, ev);
if (ev.which === KeyCodes.enter) {
this._onKeyDown(this._onSelectNextMonth, ev);
}
}

private _getWeeks(propsToUse: ICalendarDayProps): IDayInfo[][] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ export class CalendarMonth extends BaseComponent<ICalendarMonthProps, {}> {
}

private _onSelectNextYearKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {
this._onKeyDown(this._onSelectNextYear, ev);
if (ev.which === KeyCodes.enter) {
this._onKeyDown(this._onSelectNextYear, ev);
}
}

private _onSelectPrevYear = (): void => {
Expand All @@ -187,7 +189,9 @@ export class CalendarMonth extends BaseComponent<ICalendarMonthProps, {}> {
}

private _onSelectPrevYearKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {
this._onKeyDown(this._onSelectPrevYear, ev);
if (ev.which === KeyCodes.enter) {
this._onKeyDown(this._onSelectPrevYear, ev);
}
}

private _onSelectMonth = (newMonth: number): void => {
Expand Down