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

[WIP] feat(ContextMenu): add base implementation #340

Closed
wants to merge 25 commits into from

Conversation

gopalgoel19
Copy link
Member

@gopalgoel19 gopalgoel19 commented Oct 9, 2018

ContextMenu

TODO

  • Conformance test
  • Minimal doc site example
  • Stardust base theme
  • Teams Light theme
  • Teams Dark theme
  • Teams Contrast theme
  • Confirm RTL usage
  • W3 accessibility check
  • Stardust accessibility check
  • Update glossary props table
  • Update the CHANGELOG.md

@gopalgoel19 gopalgoel19 force-pushed the feat/contextmenu-base-implementation branch from c35d235 to 549a450 Compare October 9, 2018 09:36
@codecov
Copy link

codecov bot commented Oct 9, 2018

Codecov Report

Merging #340 into master will decrease coverage by 0.04%.
The diff coverage is 86.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #340      +/-   ##
==========================================
- Coverage   89.59%   89.54%   -0.05%     
==========================================
  Files          62       64       +2     
  Lines        1220     1243      +23     
  Branches      156      181      +25     
==========================================
+ Hits         1093     1113      +20     
- Misses        125      128       +3     
  Partials        2        2
Impacted Files Coverage Δ
src/index.ts 100% <100%> (ø) ⬆️
src/components/ContextMenu/index.tsx 100% <100%> (ø)
src/components/ContextMenu/ContextMenu.tsx 85% <85%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 763973a...0b10e5f. Read the comment docs.

@jurokapsiar
Copy link
Contributor

please look at the submenu PR which implements an accessible submenu: #126

itemProps.onClick = onItemClick
return ListItem.create(item, { defaultProps: itemProps })
})
return <List selection={true}>{children}</List>
Copy link
Contributor

Choose a reason for hiding this comment

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

use Menu component for API consistency, styling and accessibility. If Menu does not support all requirements needed, we can extend it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jurokapsiar That is the reason I used Menu component when I started building it. However, I moved away from Menu to List because List component fulfilled all the requirements needed( was not sure about accessibility ). But alright, let me stick to Menu component.

}}
// content={<ContextMenu items={item.menu.items} onItemClick={onItemClick} />}
>
{ListItem.create(item, { defaultProps: itemProps })}
Copy link
Contributor

Choose a reason for hiding this comment

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

use MenuItem component for API consistency, styling and accessibility. If MenuItem does not support all requirements needed, we can extend it.

/** The tree of menu containing submenus and it's submenus and so on. */
items: PropTypes.arrayOf(PropTypes.object),

/** Function passed which needs to be invoked when menuitem has no submenu */
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't really understand comment. For menu, we have onclick on the menu-items. Can't we do same here? It's very likely that different menu items what to call different functions.... (and nit - end comment with '.')

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but this just handles the case of one callback function for all menu-items. The onClick on all items will also work at the same time.

fontFamily: 'Segoe UI',
...(item.divider && {
borderBottom: '2px solid #F3F2F1',
}),
Copy link
Member

Choose a reason for hiding this comment

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

remove styles here please

@gopalgoel19
Copy link
Member Author

As per the discussion with Levi, it would be better to build a ContextMenu form scratch instead of relying on Menu/List component. I will be working on a new PR and closing this PR for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants