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": "BaseButton: Allow Alt + Down on menu buttons to open the menu",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export class BaseButton extends BaseComponent<IBaseButtonProps, IBaseButtonState

private _openMenu = (shouldFocusOnContainer?: boolean): void => {
if (this.props.menuProps) {
const menuProps = {...this.props.menuProps, shouldFocusOnContainer: shouldFocusOnContainer };
const menuProps = { ...this.props.menuProps, shouldFocusOnContainer: shouldFocusOnContainer };
if (this.props.persistMenu) {
menuProps.hidden = false;
}
Expand Down Expand Up @@ -679,13 +679,13 @@ export class BaseButton extends BaseComponent<IBaseButtonProps, IBaseButtonState
private _isValidMenuOpenKey(ev: React.KeyboardEvent<HTMLDivElement | HTMLAnchorElement | HTMLButtonElement>): boolean {
if (this.props.menuTriggerKeyCode) {
return ev.which === this.props.menuTriggerKeyCode;
} else {
if (this._isSplitButton) {
return ev.which === KeyCodes.down && (ev.altKey || ev.metaKey);
} else {
return ev.which === KeyCodes.enter;
}
} else if (this.props.menuProps) {
return ev.which === KeyCodes.down && (ev.altKey || ev.metaKey);
}

// Note: When enter is pressed, we will let the event continue to propagate
// to trigger the onClick event on the button
return false;
}

private _onMenuClick = (ev: React.MouseEvent<HTMLDivElement | HTMLAnchorElement>) => {
Expand Down