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": "Revert removal of should render DatePicker guard given focus changes with Layer changes.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS
private _calendar = createRef<ICalendar>();
private _datePickerDiv = createRef<HTMLDivElement>();
private _textField = createRef<ITextField>();
private _preventFocusOpeningPicker: boolean;

constructor(props: IDatePickerProps) {
super(props);
this.state = this._getDefaultState();

this._preventFocusOpeningPicker = false;
}

public componentWillReceiveProps(nextProps: IDatePickerProps): void {
Expand Down Expand Up @@ -291,7 +294,11 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS
}

if (!this.props.allowTextInput) {
this._showDatePickerPopup();
if (!this._preventFocusOpeningPicker) {
this._showDatePickerPopup();
} else {
this._preventFocusOpeningPicker = false;
}
}
};

Expand Down Expand Up @@ -361,6 +368,7 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS

private _showDatePickerPopup(): void {
if (!this.state.isDatePickerShown) {
this._preventFocusOpeningPicker = true;
this.setState({
isDatePickerShown: true,
errorMessage: ''
Expand All @@ -382,6 +390,7 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS
* Callback for closing the calendar callout
*/
private _calendarDismissed = (): void => {
this._preventFocusOpeningPicker = true;
this._dismissDatePickerPopup();
// don't need to focus the text box, if necessary the focusTrapZone will do it
};
Expand Down