File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
front_end/ui/legacy/components/data_grid Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2828/* eslint-disable rulesdir/no-imperative-dom-api */
2929
3030import * as Common from '../../../../core/common/common.js' ;
31+ import * as Host from '../../../../core/host/host.js' ;
3132import * as i18n from '../../../../core/i18n/i18n.js' ;
3233import * as Platform from '../../../../core/platform/platform.js' ;
3334import * as VisualLogging from '../../../visual_logging/visual_logging.js' ;
@@ -1375,7 +1376,20 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
13751376 return ;
13761377 }
13771378
1378- if ( ( event as MouseEvent ) . metaKey ) {
1379+ /**
1380+ * Support Meta-Click (Cmd/Alt) or Ctrl-Click to toggle; if the row is
1381+ * selected we will then deselect it. You might think: why do we even gate
1382+ * this behind an additional key?
1383+ * Well, we tried to change that, but there are instances where we have
1384+ * multiple click handlers on a row, and so we cannot rely on select() only
1385+ * being called once. Sometimes by the time this event listener gets called,
1386+ * another click() handler has already marked this node as selected, so if
1387+ * we deselect it here, we are making the user unable to actually select a
1388+ * node. See crbug.com/409474445 for some cotext
1389+ */
1390+ const mouseEvent = event as MouseEvent ;
1391+ const modifier = Host . Platform . platform ( ) === 'mac' ? mouseEvent . metaKey : mouseEvent . ctrlKey ;
1392+ if ( modifier ) {
13791393 if ( gridNode . selected ) {
13801394 gridNode . deselect ( ) ;
13811395 } else {
You can’t perform that action at this time.
0 commit comments