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": "FocusZone.Focus now respects forceIntoFirstChild parameter and IFocusZone.ts has been updated to reflect this",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class FocusZone extends BaseComponent<IFocusZoneProps, {}> implements IFo

/**
* Sets focus to the first tabbable item in the zone.
* @param {boolean} forceIntoFirstElement If true, focus will be forced into the first element, even if focus is already in the focus zone.
* @returns True if focus could be set to an active element, false if no operation was taken.
*/
public focus(forceIntoFirstElement: boolean = false): boolean {
Expand All @@ -153,7 +154,7 @@ export class FocusZone extends BaseComponent<IFocusZoneProps, {}> implements IFo
}

return false;
} else if (this._activeElement && elementContains(this._root, this._activeElement)
} else if (!forceIntoFirstElement && this._activeElement && elementContains(this._root, this._activeElement)
&& isElementTabbable(this._activeElement)) {
this._activeElement.focus();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { FocusZone } from './FocusZone';
export interface IFocusZone {
/**
* Sets focus to the first tabbable item in the zone.
* @param {boolean} forceIntoFirstElement If true, focus will be forced into the first element, even if focus is already in the focus zone.
* @returns True if focus could be set to an active element, false if no operation was taken.
*/
focus(): boolean;
focus(forceIntoFirstElement?: boolean): boolean;

/**
* Sets focus to a specific child element within the zone. This can be used in conjunction with
Expand Down