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": "Remove out-of-date IE focus handling work-around. Pass forceFocusInsideTrap={false} to DatePicker FocusTrapZone. Adjust FocusTrapZone return focus handling.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "phtucker@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS

public componentDidUpdate(prevProps: IDatePickerProps, prevState: IDatePickerState) {
if (prevState.isDatePickerShown && !this.state.isDatePickerShown) {
// In browsers like IE, textfield gets unfocused when datepicker is collapsed
if (this.props.allowTextInput) {
this._async.requestAnimationFrame(() => this.focus());
}

// If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss
if (this.props.onAfterMenuDismiss) {
this.props.onAfterMenuDismiss();
Expand Down Expand Up @@ -236,7 +231,7 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS
onDismiss={this._calendarDismissed}
onPositioned={this._onCalloutPositioned}
>
<FocusTrapZone isClickableOutsideFocusTrap={true} disableFirstFocus={this.props.disableAutoFocus}>
<FocusTrapZone isClickableOutsideFocusTrap={true} disableFirstFocus={this.props.disableAutoFocus} forceFocusInsideTrap={false}>
<CalendarType
{...calendarProps}
onSelectDate={this._onSelectDate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ export class FocusTrapZone extends React.Component<IFocusTrapZoneProps, {}> impl
}

public componentWillUnmount(): void {
if (!this.props.disabled) {
// don't handle return focus unless forceFocusInsideTrap is true or focus is still within FocusTrapZone
if (
!this.props.disabled ||
this.props.forceFocusInsideTrap ||
!elementContains(this._root.current, document.activeElement as HTMLElement)
) {
this._returnFocusToInitiator();
}
}
Expand Down