Theia: Can close widget tab via context menu even if set as not closeable

Created on 4 Mar 2020  路  2Comments  路  Source: eclipse-theia/theia

Description

Setting title.closable = false on a widget doesn't prevent it from being closed via context menu.

Reproduction Steps

  1. Create a widget.
  2. Set title.closable = false in constructor/init.
  3. Right click on the tab.
  4. The "Close" menu item shows, it should not.
bug help wanted shell

Most helpful comment

@vince-fugnitto I think it should not have any implications on widgets in this repo, since they are all closable. By if an end product wants to add a widget which is never can be closed. It should be possible for them.

All 2 comments

@Hanksha the closable field is provided by the @phosphor API and is only actionable at the moment for titles.

/**
* Set the closable state for the title.
*
* #### Notes
* This controls the presence of a close icon when applicable.
*/
closable: boolean;

Do you suggest we update the isEnabled of CLOSE commands to respect the property?
If so, I wonder the UX implications it might have. If a user opens a widget, that widget can no longer be closed successfully unless somehow programatically triggered.

If you'd like, you can submit a pull-request to address the issue, it looks like you'd need to update the isEnabled for the following commands:

https://github.com/eclipse-theia/theia/blob/master/packages/core/src/browser/common-frontend-contribution.ts#L522-L580

Something like the following POC (for close):

image

@vince-fugnitto I think it should not have any implications on widgets in this repo, since they are all closable. By if an end product wants to add a widget which is never can be closed. It should be possible for them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fangnx picture fangnx  路  3Comments

cekvenich picture cekvenich  路  3Comments

pwFoo picture pwFoo  路  3Comments

Beetix picture Beetix  路  3Comments

vince-fugnitto picture vince-fugnitto  路  3Comments