Commit 48636890 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

Remove unnecessary context menu flicker

Context menu 'New Folder' selection was causing the menu to jump
up and down (easier seen on captured video on the bug). This was
caused by a 'change' event fired that updated the state of the
context menu tasks-separator bar to visible despite there being
no items above it (which in turn, makes the menu taller temporarily).
That happened mid-animation of the menu and the bar is reset to
hidden after more event processing. Removing the fake data that
was passed into the updateContextMenuTaskItems_() method stops
it happening.

      offending code to visually check fix works. Ran test on
      desktop and real device to confirm.

Bug: 698176
Test: Ran all FilesApp browser tests. Single-stepped through the
Change-Id: Icd7a2c41ad85bf93e30fe90632d83a8890b294bf
Reviewed-on: https://chromium-review.googlesource.com/c/1347631Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610283}
parent 18973063
......@@ -154,31 +154,6 @@ function TaskController(
this.updateTasks_.bind(this));
}
/**
* Cached the temporary disabled task item. Used inside
* FileSelectionHandler.createTemporaryDisabledTaskItem_().
* @type {Object}
* @private
*/
TaskController.cachedDisabledTaskItem_ = null;
/**
* Create the temporary disabled task item.
* @return {Object} Created disabled item.
* @private
*/
TaskController.createTemporaryDisabledTaskItem_ = function() {
if (!TaskController.cachedDisabledTaskItem_) {
TaskController.cachedDisabledTaskItem_ = {
title: str('TASK_OPEN'),
disabled: true,
taskId: null
};
}
return TaskController.cachedDisabledTaskItem_;
};
/**
* Task combobox handler.
*
......@@ -334,11 +309,8 @@ TaskController.prototype.onSelectionChanged_ = function() {
(selection.directoryCount > 0 || selection.fileCount > 0)) {
// Compare entries while ignoring changes inside directories.
if (!util.isSameEntries(this.lastSelectedEntries_, selection.entries)) {
// Show disabled items for position calculation of the menu. They will be
// overridden in this.updateTasks_().
this.updateContextMenuTaskItems_(
[TaskController.createTemporaryDisabledTaskItem_()],
[TaskController.createTemporaryDisabledTaskItem_()]);
// Update the context menu if selection changed.
this.updateContextMenuTaskItems_([], []);
}
} else {
// Update context menu.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment