Closed Bug 1692764 Opened 4 years ago Closed 4 years ago

Right clicking on a folder mode header makes the tree unresponsive

Categories

(Thunderbird :: Folder and Message Lists, defect, P2)

Thunderbird 86

Tracking

(thunderbird_esr78 unaffected, thunderbird87 affected)

RESOLVED FIXED
88 Branch
Tracking Status
thunderbird_esr78 --- unaffected
thunderbird87 --- affected

People

(Reporter: wsmwk, Assigned: aleca)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

I assume this is a regression of sorts.

  1. enable Folder Pane Toolbar
  2. enable a second type of folder, Favorites
  3. click on All Folders
  4. File > Compact Folders
  5. click any folder

Results: message list does not change. must restart Thunderbird

Expected results: Compact menu item should probably be disabled when folder type is focused.

Flags: needinfo?(alessandro)

Walt, can you reproduce this?

Step 4 can also be just as simple as right clicking on All Folders or Favorite Folders - no action needs to be selected (none is presented).
Still nothing in error console.

Somehow I managed in one iteration to get folder switching to work again without restarting. I think it involved creating a new message. In another iteration I right clicked on an account and picked "New Folder" which seems to consistently reverse the folder switching problem.

Flags: needinfo?(wls220spring)

Yes, I can reproduce this using Thunderbird 86.0b3 on Fedora 33 Workstation.

I used Unread and All Folders for my test.

Didn't get it to work by creating a new message or new folder.

Flags: needinfo?(wls220spring)
Assignee: nobody → alessandro
Flags: needinfo?(alessandro)
Regressed by: 1163555
Summary: unable to switch folders after File > Compact on pinned folder type → Unable to switch folders after usgin File > Compact Folders when a Folder Mode Header is selected

I'm able to reproduce this only with a right click.
It seems that the return false; on the opening of the context menu freezes the UI, regardless if the File > Compact Folders is used.

Severity: S3 → S2
Priority: -- → P2
Summary: Unable to switch folders after usgin File > Compact Folders when a Folder Mode Header is selected → Right clicking on a folder mode header makes the tree unresponsive

All right, this is tricky.

It seems that returning false when right clicking on a Folder Mode Header, causes the tree to sort of freeze to the point where selecting other rows doesn't change the thread view.

I fixed it by allowing the context menu to be shown also on the Header Modes, but showing only the "Search Messages" item, which is the only one that works without a properly selected folder.
I think this is acceptable as an intermediate step to fix this issue, and also the initial step for bug 1686306, where I'm planning to implement sorting options for folder modes, with menu items in the context menu to move up and down the selected mode.

The fillFolderPaneContextMenu() is very messy, but I didn't want to update the code too much and only focus on the part to make the tree work.
If this gets approved, I'd like to do a quick follow up to clean up the code which needs a lot of love.

Attachment #9205580 - Flags: review?(mkmelin+mozilla)
Status: NEW → ASSIGNED
Comment on attachment 9205580 [details] [diff] [review] 1692764-folder-compact-header.diff Review of attachment 9205580 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/base/content/folderPane.js @@ +756,5 @@ > * Returns an array of nsIMsgFolders corresponding to the current selection > + * in the tree. > + * > + * @param {boolean} includeHeaders - If folder mode headers should be included > + * in the returned array. But the headers are not folders, so for the one case you want them, maybe add a special function to get only those, so that we don't confuse things? ::: mail/base/content/mailContextMenus.js @@ +279,5 @@ > if (!folders.length) { > return false; > } > > + let haveAnyVirtualFolders = folders.some( you could just inline this one as well @@ +361,4 @@ > function checkCanGetMessages(folder) { > + if (!folder) { > + return false; > + } Is it ever null? @@ +470,5 @@ > } > > // --- Set up the delete folder menu item. > function checkCanDeleteFolder(folder) { > + if (!folder) { when is it null? ::: mail/base/content/msgMail3PaneWindow.js @@ +1482,5 @@ > * leave the selection as is. If it is part of the selection and > * aSingleSelect then we create a transient single-row selection. > */ > function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) { > + // Return if we don't have a view. This might if the user right clicks on the might happen?
Attachment #9205580 - Flags: review?(mkmelin+mozilla)

Did you figure out why returning false makes it freeze?

(In reply to Magnus Melin [:mkmelin] from comment #6)

Did you figure out why returning false makes it freeze?

No idea, and it baffles me.
Do you have any hint?

I found the issue!

Right clicking on a mode header grabs the selection without properly restoring it to the original treechildren like it happens for any other element.
So the tree remains stuck on a selection that is not really a folder and it's not able to move it to another clicked item.

Ensuring that we restore the original selection if the user right clicks on a mode header fixes the problem.
I'll defer the code improvements to the generation of the context menu to another bug since this fix is very simple.

Attachment #9205580 - Attachment is obsolete: true
Attachment #9206516 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9206516 [details] [diff] [review] 1692764-mode-header-right-click.diff Review of attachment 9206516 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for digging into it! r=mkmelin
Attachment #9206516 - Flags: review?(mkmelin+mozilla) → review+
Target Milestone: --- → 88 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/bebb326ced3f
Fix right click freezing the folder pane when a Mode Header is selected. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: