-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Core: Do no expand the widgets on the side-bars for the context menu #6965
Core: Do no expand the widgets on the side-bars for the context menu #6965
Conversation
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.
Unfortunately, it does not work in all cases. Sometimes when using the context-menu to close a view, the previously active view is closed instead. There looks to me more work involved:
Here I moved my changelog.md
to the sidepanel, and my explorer
was previously active.
Using the context-menu to try and close the changelog.md
results in the explorer
being closed instead.
618b5a8
to
87895ce
Compare
@vince-fugnitto I have fixed the issue and am ready for review. |
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.
There are conflicts. Need to rebase to latest master |
87895ce
to
4cd588a
Compare
@vince-fugnitto, can you review the updated changes? |
d4b49e1
to
faf5af7
Compare
@lmcbout can you review? |
@Anasshahidd21 a change breaking context menu is still not reverted, with this PR the current widget won't be proper. |
If you want to remove an activation of tabs then the proper process:
|
As mentioned by @akosyakov , the menu item "Reveal in Explorer " is not available if I put the focus on the preference editor and try to open the context menu after. See video. |
fedeb34
to
c0137d8
Compare
d478265
to
6526086
Compare
6526086
to
32e1a0b
Compare
import { ApplicationShell } from './shell/application-shell'; | ||
|
||
@injectable() | ||
export class ContextMenuService { |
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.
It looks weird. ContextMenuService
will be responsible to open and close context menus, not a bunch of utility methods.
That should belong to ApplicationShell
.
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.
I think we should just delete this class and rewrite commands with existing APIs, there are enough already of them.
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.
@Anasshahidd21 keybindings for tabbar context-menu items are broken with this pull-request.
For example, try to toggle maximized
using the keybinding on master versus this pull-request.
b5b9cb6
to
9d33d71
Compare
@akosyakov @vince-fugnitto @lmcbout @marechal-p thank you for your past reviews. I have updated the code to address the comments, and I am ready for another review. |
Changes look good if there are no any other affected commands. |
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.
The changes work well 👍 ! Tested all the use cases mentioned above for the main view container
, the bottom panel
and the sidebar view
. The keybindings for Toggle Maximized
, Collapse
and Reveal In Explorer
also work correctly.
9d33d71
to
7c31a82
Compare
7c31a82
to
8a1e0ab
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.
I verified the functionality (both browser
and electron
) and it works well.
I'd like for others to review as well, perhaps you'd like to @kittaakos I believe you opened the original issue.
9ceaaa3
to
f10da77
Compare
Let's fix the linter error: diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts
index 33eacca0c..0bd3ca0c5 100644
--- a/packages/core/src/browser/common-frontend-contribution.ts
+++ b/packages/core/src/browser/common-frontend-contribution.ts
@@ -18,7 +18,7 @@
import debounce = require('lodash.debounce');
import { injectable, inject } from 'inversify';
-import { TabBar, Widget, Title } from '@phosphor/widgets';
+import { TabBar, Widget } from '@phosphor/widgets';
import { MAIN_MENU_BAR, MenuContribution, MenuModelRegistry } from '../common/menu';
import { KeybindingContribution, KeybindingRegistry } from './keybinding';
import { FrontendApplicationContribution } from './frontend-application'; |
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.
I tried it out with the electron example, the widgets do not expand on context menu render. I left a few comments, it's up to you if you want to consider them. Thank you for the fix, @Anasshahidd21! Please resolve the linter error.
* @param event used to find the selected widget. | ||
*/ | ||
private toggleMaximized(event?: Event): void { | ||
if (event && event.target) { |
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.
[minor]: if (event?.target instanceof HTMLElement)
, and you can get rid of the static cast below.
* @returns the selected tab-bar, else returns the currentTabBar. | ||
*/ | ||
findTabBar(event?: Event): TabBar<Widget> | undefined { | ||
if (event && event.target) { |
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.
[minor]: Same as above: if (event?.target instanceof HTMLElement)
.
findTitle(tabBar: TabBar<Widget>, event?: Event): Title<Widget> | undefined { | ||
if (event && event.target) { | ||
let tabNode: HTMLElement | null = event.target as HTMLElement; | ||
while (tabNode && !tabNode.classList.contains('p-TabBar-tab')) { |
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.
[minor]: Can we use closest
? But I am fine with the current logic too.
2155a89
to
976a752
Compare
@akosyakov @kittaakos is there any objection to merge the pull-request, or should we wait after the release? |
I do not mind merging it. If you're unsure, you can wait. |
I'll merge tomorrow if there are no objections 👍 |
976a752
to
f4f313a
Compare
f4f313a
to
d3434e9
Compare
Fixes: eclipse-theia#4367 Before, right clicking on different menus would focus the menu item and open it, however this should not be the case. There was a dangling code in the handleContextMenu which causes this effect, as it was checking for the id when right clicked and looked up the ID for the menu-item and set the current title to the menu-item. Signed-off-by: Muhammad Anas Shahid <muhammad.shahid@mail.mcgill.ca>
d3434e9
to
9d45578
Compare
Merging 🍾 |
What it does
Fixes: #4367
With this PR, upon triggering the context menu, the widget is not activated. This helps perform commands on the context menu without actually giving focus to the widget.
Context menu commands analysed and affected with this change
Close
Close Others
Close to the right
Close All
Toggle Maximized
Reveal in Explorer
Collapse
Signed-off-by: Muhammad Anas Shahid muhammad.shahid@ericsson.com
How to test
not
be take focus and still will be able toclose the tab
not
take focus and still will be able toclose all other tabs
not
take focus and still will be able toclose the tab available on the right
Toggle Maximized
Maximizes the currentWidget
not
take focus and still will be able tomaximize the right clicked widget
Reveal In Explorer
reveals in the file-explorer
not
take focus and still will be able toreveal the right clicked tab on the file-explorer
Review checklist
Reminder for reviewers