Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(menu): Submenu #539

Merged
merged 62 commits into from
Dec 19, 2018
Merged

feat(menu): Submenu #539

merged 62 commits into from
Dec 19, 2018

Conversation

jurokapsiar
Copy link
Contributor

@jurokapsiar jurokapsiar commented Nov 29, 2018

Based on two previous menu/submenu PRs. Fixes #542

Missing things:

  • document click / focus out should close submenu
  • action should close submenu
  • left/right key should move to the next/previous menu item according to ARIA practices
  • submenu indicator
  • commented out overflow, not sure why it was there, need to verify
  • verify wrapper render

Update by @mnajdova
Some questions:

  • I needed to add key to the wrapper element created, so in the defaultProps I added key that is generated by a new added dependency uniqid. Are we ok with this?
  • The tests are failing, I guess because I added Ref wrapper around the ElementType. How can be tackle this? Is the wrapper maybe causing this?
  • How are we handling event handlers when we have wrapper? There is issue with the onClick event, which is added on the wrapper, but on the anchor is added only if the wrapper is not added. Am I doing something wrong here?

The questions were resolved thanks to @layershifter

All accessibility requirements are added, let me know if you find some issue with it.

@layershifter
Copy link
Member

Should we use the kind prop to simplify the render logic, #512?

@@ -28,7 +28,7 @@ export default {
...solidBorder(variables.primaryBorderColor),
}),
borderRadius: pxToRem(4),
overflow: 'hidden',
// overflow: 'hidden',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this needs to be verified - it breaks submenu when oveflow is hidden

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the PR that added it: #360 Will sync with @Bugaa92 for finding alternative solution for the cropped borders, I have new ideas.

@mnajdova mnajdova self-assigned this Nov 30, 2018
manajdov added 3 commits November 30, 2018 15:29
-small fixes in the styles and the way the submenu is generated
…be done for enter/space)

-applied consistent (left-right) navigation for horizontal menu and (up-down) navigation for vertical menu
# Conflicts:
#	src/components/Menu/Menu.tsx
#	src/components/Menu/MenuItem.tsx
manajdov added 2 commits December 7, 2018 15:13
-implemented enter key on leaf menu item to close the menu
manajdov added 3 commits December 18, 2018 18:46
-fixed issue with the condition for the active prop
-added correct typings to the menuStyles
@mnajdova
Copy link
Contributor

All comments are resolved. I changed the look of the hovered/focused vs active styles. Couple of examples of the variants:
image
image
image
image
image

…ild menu items and the last child menu items in vertical menu
defaultColor: siteVars.gray06,
defaultBackgroundColor: siteVars.brand,
typePrimaryActiveBorderColor: siteVars.white,
color: siteVars.gray06,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

src/components/Menu/MenuItem.tsx Outdated Show resolved Hide resolved
const { active, menu } = this.props
if (menu) {
if (doesNodeContainClick(this.menuRef.current, e)) {
// submenu was clicked => close it and propagate
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for comments, very helpful ones!

src/components/Menu/MenuItem.tsx Outdated Show resolved Hide resolved
src/components/Menu/MenuItem.tsx Outdated Show resolved Hide resolved
@kuzhelov kuzhelov added 🚀 ready for review and removed needs author feedback Author's opinion is asked labels Dec 19, 2018
miroslavstastny and others added 16 commits December 19, 2018 16:19
* implement caching strategy

* adjust file name of scan marker

* add yarn lock hash to marker file name

* add change to build config

* fix dir name in build config

* improve caching strategy

* just restore cache

* temporary remove lint and tests

* try

* fix caching strategy

* try

* try

* try

* try epoch

* create file on scan

* return lint and test steps

* introduce comment for the caching approach taken

* remove unnecessary function

* simplify expression for marker file name
* feat(text): color prop

* addressed comments

* changelog

* amended changelog

* made text color override other props that change color
* feat(header): header and header description color prop

* changelog

* fixed examples

* addressed PR comments
* introduce offset prop

* correct description of supported values

* update changelog

* introduce fix

* ensure RTL is properly applied to complex offset expressions

* rename method to make logic more expressive

* add unit tests

* remove unnecessary grid props from offset example

* update changelog
* Reflect which item is selected in list

* Make list derived from autocontrolled component

* small fix

* Update ListExampleSelection.tsx

* Update ListExampleSelection.shorthand.tsx

* Small improvement

* Rename *ItemIndex -> *Index

* Names refactoring

* Minor improvements

* update changelog

* Add onSelectedIndexChange

* Add some tests

* Small improvements afer CR

* Small improvements afer CR

* Small improvements afer CR

* create focus handler when List is constructed

* fix changelog

* changelog
* docs(Examples): allow to use TS in examples

* add jsdoc

* fix typo

* rename file

* add comment

* `createExample` to `createExampleSourceCode`

* rework with `path.relative()`

* remove JSON files on remove tsx

* create getRelativePathToSource function
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Core Team
  
mnajdova
Development

Successfully merging this pull request may close these issues.

[RFC] Submenu functionality in Menu component
6 participants