Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added navigation by arrows inside context menu #35

Merged
merged 3 commits into from
Jun 28, 2017

Conversation

Yura13
Copy link
Contributor

@Yura13 Yura13 commented Jun 27, 2017

added navigation by arrows inside context menu

Copy link
Owner

@isaacplmann isaacplmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need some way of determining which context menu is the currently focused one (leaf menu) - so that you don't have multiple context menu items selected when sub menus are open.

Here's what I recommend:

  1. Look at ContextMenuComponent.destroyLeafMenu to see how the escape key only removes the leaf menu.
  2. Update ContextMenuService to provide a getLeafMenu function that returns the ContextMenuContextComponent that is the current leaf menu.
  3. Use that information to conditionally trigger the key bindings.

@@ -216,6 +226,62 @@ export class ContextMenuContentComponent implements OnInit, OnDestroy, AfterView
this.changeDetector.markForCheck();
}

@HostListener('document:keydown', ['$event'])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can let angular handle a lot of this KeyboardEvent logic for you by using listeners like document:keydown.ArrowDown on the relevant functions directly.

@isaacplmann
Copy link
Owner

Good work solving the tabbing issue by tracking the activeMenuItemIndex by the way. That solves a big piece of this.

@Yura13
Copy link
Contributor Author

Yura13 commented Jun 28, 2017

Could you help with your comments?
I added you as a contributor of my forked repository.

@isaacplmann
Copy link
Owner

I'm merging this in to finish working on it. Thanks for your help!

@isaacplmann isaacplmann merged commit ffffaeb into isaacplmann:master Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants