-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[UI Framework] Add KuiContextMenu. #14183
[UI Framework] Add KuiContextMenu. #14183
Conversation
cd962b9
to
a35df3a
Compare
@stacey-gammon Could you take a look at this and advise me on how this affects #13853? There was a merge conflict with the changes you made to @timroes Could you take a look and let me know what you think of these changes in terms of accessibility? A more general code review would also be welcome from each of you if you have time. |
I only skimmed through some of the changes, but in general it looks like we need more component tests here. Some of these components are fairly complex. |
@kjbekkelund You got me! Thanks for keeping me honest. I just pushed a bunch of tests. Would you mind taking a look? @timroes I also made some tweaks to the KuiCodeEditor tests. Could you look them over please? @stacey-gammon I also updated the snapshot for the dashboard_panel test. Could you take a look and let me know what you think? Thanks, everyone! |
c58e181
to
0716794
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is touching a ton of files and has lots of little changes, so it's not the easiest to review. But the tests are definitely looking better now. I haven't gone through every component as I just didn't have time right now.
|
||
const classes = classNames( | ||
{ | ||
'kuiPopoverTitle': children, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
children
isn't clear here. It needs a test, plus we should maybe change this to children != null
or something like that? It's difficult to understand the intention right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch... I don't think this is necessary at all.
@kjbekkelund Thanks man. I'm going to try to break this PR up a bit to make it easier to review. I'll let you know when it's been deflated. |
c8957b4
to
0c367d5
Compare
This really is a rather large PR and it looks fine. I skipped through the code and as @kjbekkelund already mentioned, it's touching quite some files :-) So I also feel hard to just say, everything is fine (though it looks like everything is working). |
7c511ab
to
4702788
Compare
@kjbekkelund @timroes I've extracted out as much as I possibly can from this PR. Could you take another look? It's still a daunting PR based solely on size, but I think it becomes easier if you review one component at a time:
@stacey-gammon Could you take a look at the Dashboard panel and verify that it still functions correctly? |
The last commit ( |
4702788
to
98a91bc
Compare
Good catch @kjbekkelund, fixed. Sorry about that. |
I think there is a bug when you click on Otherwise, it works great! |
@stacey-gammon great catch, fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, the UX of that is awesome!
I have a few suggestions on how to improve the React components' apis, mainly of KuiContextMenu
itself:
- Split out the transition part into a
HorizontalSwipeTransition
component or similar. - Replace the confusing
idToPanelMap
andidToPreviousPanelMap
props with a flattenedpanels
map, where each panel references its children via id - Use an array of panel ids as the
currentPanelPath
state so we can derive the "previous" panel from the state.
Let's maybe talk about this synchronously some time?
@weltenwort I just pushed a commit which uses a flat |
@weltenwort Thanks for all of your help! I like your suggestion but I think I'll need some help implementing it. The problem we need to overcome is that the application state doesn't map cleanly to the visual state due to the fade-out transition when the the ContextMenu closes. In the owner, We could solve this by adding a |
@cjcenizal, I think what you are looking for is https://github.com/reactjs/react-transition-group with its |
Ah ha! Thanks man! |
- Update KuiPopover to use K7 code. - Add KuiPanelSimple for use within KuiPopover; it's just the K7 KuiPanel renamed. - Refactor/rewrite KuiExpression and KuiExpressionButton to depend upon KuiPopover. - Add K7 shadow mixins and size and z-index vars to global_styling.
- Refactor tests to use a test subject selector to locate the hint element. - Refine tests to leverage snapshots instead of DOM assertions.
- Update snapshot. - Update Jest config to make snapshotComponent available to Kibana src.
- Move keyboard navigation logic into KuiContextPanel. - Add example to doc site. - Update tests.
…tMenuPanel. - Rename 'current panel' to 'incoming panel' for cohesion with 'outgoing panel.'
… and update tests.
5796c71
to
9ab0a13
Compare
@weltenwort I looked into I'm going to merge this because complementary parts of it have been looked over by different engineers, so I feel comfortable with the code's correctness and quality at this point. |
* Add KuiContextMenu. - Update KuiPopover to use K7 code. - Add KuiPanelSimple for use within KuiPopover; it's just the K7 KuiPanel renamed. - Refactor/rewrite KuiExpression and KuiExpressionButton to depend upon KuiPopover. - Add K7 shadow mixins and size and z-index vars to global_styling. * Update Dashboard panel to use KuiContextMenu. - Fix reloading issue when editing a visualization from within a dashboard. * Completely refactor KuiContextMenu to enable a single panel. - Move keyboard navigation logic into KuiContextPanel. - Set focus on the item which shows the panel we're leaving within KuiContextMenu. - Remove unnecessary logic from KuiPopoverTitle. - Replace confusing idToPanelMap and idToPreviousPanelIdMap props with a panels prop. - Replace panelRef prop with onHeightChange prop. - Migrate transition state and logic from KuiContextMenu into KuiContextMenuPanel. - Rename 'current panel' to 'incoming panel' for cohesion with 'outgoing panel.' - Map panel items to panels up-front. - Convert maps from state variables into instance variables.
* Add KuiContextMenu. - Update KuiPopover to use K7 code. - Add KuiPanelSimple for use within KuiPopover; it's just the K7 KuiPanel renamed. - Refactor/rewrite KuiExpression and KuiExpressionButton to depend upon KuiPopover. - Add K7 shadow mixins and size and z-index vars to global_styling. * Update Dashboard panel to use KuiContextMenu. - Fix reloading issue when editing a visualization from within a dashboard. * Completely refactor KuiContextMenu to enable a single panel. - Move keyboard navigation logic into KuiContextPanel. - Set focus on the item which shows the panel we're leaving within KuiContextMenu. - Remove unnecessary logic from KuiPopoverTitle. - Replace confusing idToPanelMap and idToPreviousPanelIdMap props with a panels prop. - Replace panelRef prop with onHeightChange prop. - Migrate transition state and logic from KuiContextMenu into KuiContextMenuPanel. - Rename 'current panel' to 'incoming panel' for cohesion with 'outgoing panel.' - Map panel items to panels up-front. - Convert maps from state variables into instance variables.
Ports over many improvements from K7 (#14108).
To review:
ui_framework/src/global_styling
directory and changes to the files that are not related to the above components.