|
|
Created:
3 years, 8 months ago by yamaguchi Modified:
3 years, 8 months ago CC:
chromium-reviews, yamaguchi+watch_chromium.org, oka+watch_chromium.org, rginda+watch_chromium.org, mtomasz+watch_chromium.org, oshima+watch_chromium.org, fukino+watch_chromium.org, karandeepb Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionStop blocking the mousedown event of left click when closing context menu.
This change will enable to choose a file and close a context menu
simultaneously by a single click in the file list of the Files app.
Before this change, only the mousedown event of a left click which
dismisses the context menu of cr.ui was blocked its propagation.
It was introduced by https://codereview.chromium.org/1431103003,
which was been directed to 487194 and 507681.
This change will partially remove the change made by that, however,
I think Issue 507681 was resolved by the change to apps_page.js, and
487194 was done by that of title_page.js in the original change.
I confirmed that the both issues doesn't reappear by this change.
BUG=679982
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2800383002
Cr-Commit-Position: refs/heads/master@{#464285}
Committed: https://chromium.googlesource.com/chromium/src/+/3ce9680f3fb4648e3d1ff964f25648eb01fcb579
Patch Set 1 #Patch Set 2 : remove debug code. #
Total comments: 2
Patch Set 3 : Swallow mousedown events on Mac and Linux to be consistent with system context menus. #Patch Set 4 : fix comment #
Total comments: 2
Patch Set 5 : Update comment to be more descriptive of the change we make. #Messages
Total messages: 42 (27 generated)
Description was changed from ========== Stop blocking the left mouse up event when closing the context menu. BUG=679982 ========== to ========== Stop blocking the left mouse up event when closing the context menu. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
The CQ bit was checked by yamaguchi@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Stop blocking the left mouse up event when closing the context menu. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mouse-up event of the left click when closing context menu. This change will enable choosing a file by left-click and closing the context menu simultaneously in the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Description was changed from ========== Stop blocking the mouse-up event of the left click when closing context menu. This change will enable choosing a file by left-click and closing the context menu simultaneously in the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mouse-up event of left click when closing context menu. This change will enable choosing a file by left-click and closing the context menu simultaneously in the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Description was changed from ========== Stop blocking the mouse-up event of left click when closing context menu. This change will enable choosing a file by left-click and closing the context menu simultaneously in the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mouse-up event of left click when closing context menu. This change will enable choosing a file by left-click and closing the context menu simultaneously in the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Description was changed from ========== Stop blocking the mouse-up event of left click when closing context menu. This change will enable choosing a file by left-click and closing the context menu simultaneously in the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mouse-up event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
yamaguchi@chromium.org changed reviewers: + fukino@chromium.org
To fukino: Will you review this so as to make sure this will fix the issue in Files? I'll be sending this review to OWNERS of ui/webui after it.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Description was changed from ========== Stop blocking the mouse-up event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mouseup event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
lgtm if you confirmed that issue 487194 and 507681 did not reappear.
Description was changed from ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, Issue 507681 would have been resolved by the change to apps_page.js, and 487194 would have been done by that of title_page.js in the original change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, I think Issue 507681 was resolved by the change to apps_page.js, and 487194 was done by that of title_page.js in the original change. I confirmed that the both issue hasn't regressed by this change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Description was changed from ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, I think Issue 507681 was resolved by the change to apps_page.js, and 487194 was done by that of title_page.js in the original change. I confirmed that the both issue hasn't regressed by this change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, I think Issue 507681 was resolved by the change to apps_page.js, and 487194 was done by that of title_page.js in the original change. I confirmed that the both issues doesn't reappear by this change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
yamaguchi@chromium.org changed reviewers: + michaelpg@chromium.org
Michael, will you review the change?
not lgtm If I understand this change correctly, we normally stop processing left-click events that close a menu, and this change removes that behavior. So it will cause left-click events that close a menu to be further processed. This is not how operating system context menus work, nor is it how the majority of JavaScript menu toolkits work -- they normally have the same behavior that handleEvent is currently emulating. If the Files app wants to select a file on a left click, even when a menu is open (and closed by that same click), that should be done in the app itself, not globally in Chrome WebUI. Please correct me if I'm misunderstanding the effect of this change.
On 2017/04/11 22:05:16, michaelpg wrote: > not lgtm > > If I understand this change correctly, we normally stop processing left-click > events that close a menu, and this change removes that behavior. So it will > cause left-click events that close a menu to be further processed. This is not > how operating system context menus work, nor is it how the majority of > JavaScript menu toolkits work -- they normally have the same behavior that > handleEvent is currently emulating. For a reason why this is important, consider what happens after right clicking and deciding not to select any menu item. How do you close the menu with the mouse? The normal behavior -- click anywhere outside the menu to close it, without affecting whatever is clicked on -- is safe and useful, so removing it makes the UI harder to use and easier to make unwanted changes. > > If the Files app wants to select a file on a left click, even when a menu is > open (and closed by that same click), that should be done in the app itself, not > globally in Chrome WebUI. > > Please correct me if I'm misunderstanding the effect of this change.
On 2017/04/11 22:09:17, michaelpg wrote: > On 2017/04/11 22:05:16, michaelpg wrote: > > not lgtm > > > > If I understand this change correctly, we normally stop processing left-click > > events that close a menu, and this change removes that behavior. So it will > > cause left-click events that close a menu to be further processed. This is not > > how operating system context menus work, nor is it how the majority of > > JavaScript menu toolkits work -- they normally have the same behavior that > > handleEvent is currently emulating. > > > For a reason why this is important, consider what happens after right clicking > and deciding not to select any menu item. How do you close the menu with the > mouse? The normal behavior -- click anywhere outside the menu to close it, > without affecting whatever is clicked on -- is safe and useful, so removing > it makes the UI harder to use and easier to make unwanted changes. > > > > > If the Files app wants to select a file on a left click, even when a menu is > > open (and closed by that same click), that should be done in the app itself, > not > > globally in Chrome WebUI. > > > > Please correct me if I'm misunderstanding the effect of this change. Huh, just noticed that the behavior I described varies between platforms. On Chrome OS, we *do* process the mousedown natively, so nothing I said applies. But on Linux, Chrome doesn't even receive the mousedown event when a native context menu is open. I don't know whether we want to go with one decision for all platforms, or use different logic per platform... but as it stands, some platforms will behave inconsistently if we hard-code the dismiss logic here or remove it. dbeam is kinda the focus tsar, so I'll pass the buck to him :-)
michaelpg@chromium.org changed reviewers: + dbeam@chromium.org
On 2017/04/11 23:18:50, michaelpg wrote: > On 2017/04/11 22:09:17, michaelpg wrote: > > On 2017/04/11 22:05:16, michaelpg wrote: > > > not lgtm > > > > > > If I understand this change correctly, we normally stop processing > left-click > > > events that close a menu, and this change removes that behavior. So it will > > > cause left-click events that close a menu to be further processed. This is > not > > > how operating system context menus work, nor is it how the majority of > > > JavaScript menu toolkits work -- they normally have the same behavior that > > > handleEvent is currently emulating. > > > > > > For a reason why this is important, consider what happens after right clicking > > and deciding not to select any menu item. How do you close the menu with the > > mouse? The normal behavior -- click anywhere outside the menu to close it, > > without affecting whatever is clicked on -- is safe and useful, so removing > > it makes the UI harder to use and easier to make unwanted changes. > > > > > > > > If the Files app wants to select a file on a left click, even when a menu is > > > open (and closed by that same click), that should be done in the app itself, > > not > > > globally in Chrome WebUI. > > > > > > Please correct me if I'm misunderstanding the effect of this change. > > Huh, just noticed that the behavior I described varies between platforms. On > Chrome OS, we *do* process the mousedown natively, so nothing I said applies. > But on Linux, Chrome doesn't even receive the mousedown event when a native > context menu is open. > > I don't know whether we want to go with one decision for all platforms, or > use different logic per platform... but as it stands, some platforms will > behave inconsistently if we hard-code the dismiss logic here or remove it. > > dbeam is kinda the focus tsar, so I'll pass the buck to him :-) reposting events that close menus is platform-dependent. i know we do it on windows. (cuz I moved the code once: https://codereview.chromium.org/245993005/). on Linux, though, generally breaking focus or grab doesn't repost (afaik, probably depends on various things). https://cs.chromium.org/chromium/src/ui/views/controls/menu/menu_controller.c...
On 2017/04/11 23:18:50, michaelpg wrote: > On 2017/04/11 22:09:17, michaelpg wrote: > > On 2017/04/11 22:05:16, michaelpg wrote: > > > not lgtm > > > > > > If I understand this change correctly, we normally stop processing > left-click > > > events that close a menu, and this change removes that behavior. So it will > > > cause left-click events that close a menu to be further processed. This is > not > > > how operating system context menus work, nor is it how the majority of > > > JavaScript menu toolkits work -- they normally have the same behavior that > > > handleEvent is currently emulating. > > > > > > For a reason why this is important, consider what happens after right clicking > > and deciding not to select any menu item. How do you close the menu with the > > mouse? The normal behavior -- click anywhere outside the menu to close it, > > without affecting whatever is clicked on -- is safe and useful, so removing > > it makes the UI harder to use and easier to make unwanted changes. > > > > > > > > If the Files app wants to select a file on a left click, even when a menu is > > > open (and closed by that same click), that should be done in the app itself, > > not > > > globally in Chrome WebUI. > > > > > > Please correct me if I'm misunderstanding the effect of this change. > > Huh, just noticed that the behavior I described varies between platforms. On > Chrome OS, we *do* process the mousedown natively, so nothing I said applies. > But on Linux, Chrome doesn't even receive the mousedown event when a native > context menu is open. > > I don't know whether we want to go with one decision for all platforms, or > use different logic per platform... but as it stands, some platforms will > behave inconsistently if we hard-code the dismiss logic here or remove it. > > dbeam is kinda the focus tsar, so I'll pass the buck to him :-) reposting events that close menus is platform-dependent. i know we do it on windows. (cuz I moved the code once: https://codereview.chromium.org/245993005/). on Linux, though, closing menu by mousing down outside of menus generally doesn't repost, so we intentionally don't repost there: https://cs.chromium.org/chromium/src/ui/views/controls/menu/menu_controller.c... I think you should probably align with what the platforms do. Of the places this code is used a lot (I'm excluding mobile): Windows and ChromeOS repost, Mac and Linux do not.
https://codereview.chromium.org/2800383002/diff/20001/ui/webui/resources/js/c... File ui/webui/resources/js/cr/ui/context_menu_handler.js (left): https://codereview.chromium.org/2800383002/diff/20001/ui/webui/resources/js/c... ui/webui/resources/js/cr/ui/context_menu_handler.js:160: } please add this code back but do something like this: switch (e.type) { case 'mousedown': if (!this.menu.contains(e.target)) { this.hideMenu(); if (e.button == 0 && (cr.isLinux || cr.isMac)) { // Mac and Linux swallow 'mousedown' events that close menus. e.preventDefault(); e.stopPropagation(); } } else { e.preventDefault(); } break; ... }
The CQ bit was checked by yamaguchi@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by yamaguchi@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2800383002/diff/20001/ui/webui/resources/js/c... File ui/webui/resources/js/cr/ui/context_menu_handler.js (left): https://codereview.chromium.org/2800383002/diff/20001/ui/webui/resources/js/c... ui/webui/resources/js/cr/ui/context_menu_handler.js:160: } On 2017/04/11 23:43:51, Dan Beam wrote: > please add this code back but do something like this: > > switch (e.type) { > case 'mousedown': > if (!this.menu.contains(e.target)) { > this.hideMenu(); > if (e.button == 0 && (cr.isLinux || cr.isMac)) { > // Mac and Linux swallow 'mousedown' events that close menus. > e.preventDefault(); > e.stopPropagation(); > } > } else { > e.preventDefault(); > } > break; > ... > } Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm
lgtm, thanks! https://codereview.chromium.org/2800383002/diff/60001/ui/webui/resources/js/c... File ui/webui/resources/js/cr/ui/context_menu_handler.js (right): https://codereview.chromium.org/2800383002/diff/60001/ui/webui/resources/js/c... ui/webui/resources/js/cr/ui/context_menu_handler.js:158: // Mac and Linux swallow 'mousedown' events that close menus. nit: for the next person who updates this, clarify that the goal is consistency with Mac and Linux -- not responding to something Mac and Linux actually do here. e.g.: // Emulate Mac and Linux, which swallow native 'mousedown' events // that close menus.
Thanks for reviewing! https://codereview.chromium.org/2800383002/diff/60001/ui/webui/resources/js/c... File ui/webui/resources/js/cr/ui/context_menu_handler.js (right): https://codereview.chromium.org/2800383002/diff/60001/ui/webui/resources/js/c... ui/webui/resources/js/cr/ui/context_menu_handler.js:158: // Mac and Linux swallow 'mousedown' events that close menus. On 2017/04/12 19:24:55, michaelpg wrote: > nit: for the next person who updates this, clarify that the goal is consistency > with Mac and Linux -- not responding to something Mac and Linux actually do > here. e.g.: > // Emulate Mac and Linux, which swallow native 'mousedown' events > // that close menus. Done.
The CQ bit was checked by yamaguchi@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from fukino@chromium.org, michaelpg@chromium.org, dbeam@chromium.org Link to the patchset: https://codereview.chromium.org/2800383002/#ps80001 (title: "Update comment to be more descriptive of the change we make.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 80001, "attempt_start_ts": 1492045458273240, "parent_rev": "c035f184530b4a493f56a30f114e049e3d9c5cff", "commit_rev": "3ce9680f3fb4648e3d1ff964f25648eb01fcb579"}
Message was sent while issue was closed.
Description was changed from ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, I think Issue 507681 was resolved by the change to apps_page.js, and 487194 was done by that of title_page.js in the original change. I confirmed that the both issues doesn't reappear by this change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Stop blocking the mousedown event of left click when closing context menu. This change will enable to choose a file and close a context menu simultaneously by a single click in the file list of the Files app. Before this change, only the mousedown event of a left click which dismisses the context menu of cr.ui was blocked its propagation. It was introduced by https://codereview.chromium.org/1431103003, which was been directed to 487194 and 507681. This change will partially remove the change made by that, however, I think Issue 507681 was resolved by the change to apps_page.js, and 487194 was done by that of title_page.js in the original change. I confirmed that the both issues doesn't reappear by this change. BUG=679982 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2800383002 Cr-Commit-Position: refs/heads/master@{#464285} Committed: https://chromium.googlesource.com/chromium/src/+/3ce9680f3fb4648e3d1ff964f256... ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as https://chromium.googlesource.com/chromium/src/+/3ce9680f3fb4648e3d1ff964f256... |