Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebUI: Turn off search feature via html "hidden" attribute instead of polymer dom-if template #3212

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

petemill
Copy link
Member

@petemill petemill commented Aug 20, 2019

Fix brave/brave-browser#5330

This fixes the issue with the downloads page due to a timing issue with the download item list rendering. That list uses iron-list via downloads/manager.html. The list will not render if the list component's element does not have either a width or a height (via flex, explicit css, or otherwise). In the course of the page load, there is specific timing where the page has width just before the items that are provided to the iron-list are rendered. This timing could definitely be improved upstream.

The download page asks the toolbar whether the search field is clear or not (so that the download page knew to render the entire list of downloads, or one filtered to the search term).

Somehow having an extra polymer template to ensure had rendered before our toolbar would return the correct value for this caused this timing to be off, and so when the iron-list was first rendered it did not do anything because there was no width or height to the element. At any time later, forcing the iron-list to re-evaluate it's rendering ability by resizing the window (since it subscribes directly to this event), or running downloadsList.fire('iron-resize') directly, would caus the list to render successfully.

Interestingly, there is an attempt in the upstream code to force firing of this event to prevent this issue, but it actually happens too early, or rather it does not listen to all the properties that could cause this issue: https://cs.chromium.org/chromium/src/chrome/browser/resources/downloads/manager.js?rcl=044ab765751f0d98b0758a6de98265797ee67793&l=122

Submitter Checklist:

Test Plan:

As well as verifying the downloads page list is fixed via brave/brave-browser#5330, we should also verify that the search box still hides / shows appropriately:

Search shows

  1. open brave://settings
  2. verify -> Search icon shows and search switches to input when pressing / or clicking the search icon

Search does not show

  1. open brave://rewards
  2. verify -> Search icon does not show and does switch to input when pressing /

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@petemill petemill self-assigned this Aug 20, 2019
@petemill petemill force-pushed the fix-download-items-not-render branch 2 times, most recently from b0368ca to 8f9a95f Compare August 20, 2019 02:45
… polymer dom-if template

Fix brave/brave-browser#5330

This fixes the issue with the downloads page due to a timing issue with the download item list rendering. That list uses iron-list via downloads/manager.html. The list will not render if the list component's element does not have either a width or a height (via flex, explicit css, or otherwise). In the course of the page load, there is specific timing where the page has width *just* before the items that are provided to the iron-list are rendered. This timing could definitely be improved upstream.

The download page asks the toolbar whether the search field is clear or not (so that the download page knew to render the entire list of downloads, or one filtered to the search term).

Somehow having an extra polymer template to ensure had rendered before our toolbar would return the correct value for this caused this timing to be off, and so when the iron-list was first rendered it did not do anything because there was no width or height to the element. At any time later, forcing the iron-list to re-evaluate it's rendering ability by resizing the window (since it subscribes directly to this event), or running `downloadsList.fire('iron-resize')` directly, would caus the list to render successfully.

Interestingly, there is an attempt in the upstream code to force firing of this event to prevent this issue, but it actually happens too early, or rather it does not listen to all the properties that could cause this issue: https://cs.chromium.org/chromium/src/chrome/browser/resources/downloads/manager.js?rcl=044ab765751f0d98b0758a6de98265797ee67793&l=122
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test plan works great; code changes look good too 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downloads not being instantly displayed under "brave://downloads" until window resize
2 participants