Skip to content

Commit

Permalink
feat(menu): forward stay-open property to the surface
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximBalaganskiy committed Jun 3, 2023
1 parent f9bafed commit 3d08e77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/menu/src/mdc-menu.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template class="mdc-menu"
mdc-menu-surface="fixed.bind: fixed; anchor-corner.bind: anchorCorner; anchor-margin.bind: anchorMargin; hoist-to-body.bind: hoistToBody; anchor.bind: anchor; quick-open.bind: quickOpen; max-height.bind: maxHeight; open-bottom-bias.bind: openBottomBias"
mdc-menu-surface="fixed.bind: fixed; anchor-corner.bind: anchorCorner; anchor-margin.bind: anchorMargin; hoist-to-body.bind: hoistToBody; anchor.bind: anchor; quick-open.bind: quickOpen; max-height.bind: maxHeight; open-bottom-bias.bind: openBottomBias; stay-open.bind: stayOpen"
mdc-menu-surface.ref="menuSurface" keydown.trigger="handleKeydown_($event)"
mdcmenusurface:opened.trigger="handleMenuSurfaceOpened_()" mdclist:action.trigger="handleItemAction_($event)">
<slot></slot>
Expand Down
3 changes: 3 additions & 0 deletions packages/menu/src/mdc-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ export class MdcMenu extends MdcComponent<MDCMenuFoundation> {
@bindable.booleanAttr
selectOnTab: boolean;

@bindable.booleanAttr
stayOpen: boolean;

handleKeydown_(evt: KeyboardEvent) {
const focusedItemIndex = this.list_?.foundation?.getFocusedItemIndex() ?? listConstants.UNSET_INDEX;
if (this.selectOnTab && (evt.key === 'Tab' || evt.keyCode === 9)
Expand Down

0 comments on commit 3d08e77

Please sign in to comment.