Bug 1839472 - Ignore double clicks from menupopups in thread pane. r=aleca

Differential Revision: https://phabricator.services.mozilla.com/D181670

--HG--
extra : amend_source : 48dcd71ee431709506248ff26e674079bc6cb2b9
This commit is contained in:
Martin Giger 2023-06-23 08:55:28 +10:00
Родитель 1074a60718
Коммит cbab3f4733
2 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -4175,9 +4175,10 @@ var threadPane = {
},
_onDoubleClick(event) {
if (event.target.closest("button")) {
if (event.target.closest("button") || event.target.closest("menupopup")) {
// Prevent item activation if double click happens on a button inside the
// row. E.g.: Thread toggle, spam, favorite, etc.
// row. E.g.: Thread toggle, spam, favorite, etc. or in a menupopup like
// the column picker.
return;
}
this._onItemActivate(event);

Просмотреть файл

@ -22,6 +22,7 @@ var {
open_folder_in_new_tab,
switch_tab,
wait_for_all_messages_to_load,
select_click_row,
} = ChromeUtils.import(
"resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
);
@ -836,3 +837,47 @@ add_task(async function test_reset_columns_gloda_collection() {
"Test ran to completion successfully"
);
});
add_task(async function test_double_click_column_picker() {
let doubleClickFolder = await create_folder("double click folder");
await make_message_sets_in_folders([doubleClickFolder], [{ count: 1 }]);
await be_in_folder(doubleClickFolder);
await select_click_row(0);
let tabmail = document.getElementById("tabmail");
const currentTabInfo = tabmail.currentTabInfo;
let about3Pane = tabmail.currentAbout3Pane;
let colPicker = about3Pane.document.querySelector(
`th[is="tree-view-table-column-picker"] button`
);
let colPickerPopup = about3Pane.document.querySelector(
`th[is="tree-view-table-column-picker"] menupopup`
);
let shownPromise = BrowserTestUtils.waitForEvent(
colPickerPopup,
"popupshown"
);
EventUtils.synthesizeMouseAtCenter(colPicker, {}, about3Pane);
await shownPromise;
let hiddenPromise = BrowserTestUtils.waitForEvent(
colPickerPopup,
"popuphidden",
undefined,
event => event.originalTarget == colPickerPopup
);
const menuItem = colPickerPopup.querySelector('[value="threadCol"]');
menuItem.dispatchEvent(new MouseEvent("dblclick", { button: 0 }));
// The column picker menupopup doesn't close automatically on purpose.
EventUtils.synthesizeKey("VK_ESCAPE", {}, about3Pane);
await hiddenPromise;
Assert.deepEqual(
tabmail.currentTabInfo,
currentTabInfo,
"No message was opened in a tab"
);
});