-
Notifications
You must be signed in to change notification settings - Fork 877
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: Settings & 4 different ways to override #1909
Conversation
36a3c1e
to
964608f
Compare
I'm done with functionality for this PR. Just dealing with a slightly complicated rebase now. |
3a15388
to
74f5c1d
Compare
Some pure refactoring follow-ups I'd like to do for WebUIs after this:
|
74f5c1d
to
633e04d
Compare
I remember there were some difficulties- but wanted to check. Shouldn't there be icons next to each of the titles? mock-up (shown in brave/brave-browser#955 and brave/brave-browser#964): |
@srirambv already captured with brave/brave-browser#3633 - but the focus ring (aria?) looks odd. Not sure if border radius can be added? We don't have to solve this now of course |
@petemill I updated all the issues closed and added the appropriate milestone/labels/test plans 😄 Please just double check those Functionally - I called out everything I found when reviewing above 😄 Great job on this! Going to continue reviewing / looking at the code |
// then section is no longer 'selected'. | ||
// TODO(petemill): If this wasn't a chromium module, we'd simply add a handler | ||
// for scrolling away, or have the menu change selection as we scroll. | ||
stopObservingScroll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious about this code... let's say I click Get Started
. Sidebar properly shows it selected (orange). As I scroll down, it does "go out of scope" and un-select itself. But I'm not seeing Extensions
, Sync
, Appearance
, etc select themselves. Is the highlighted section supposed to be shown? (also, if so- maybe we can call out in test plan)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsclifton no support for scrolling as you move. Just kept the current chromium highlighting behavior and removed it when scrolling away so it's not confusing. As the comment says, if we want to add more custom code then we can add a feature to have the menu change selection as we scroll, but I'm not sure I'd be in favor of that as it gets complicated when there are multiple items on the screen, or the scroll never gets that far.
For now, the selection on clicking an item is a nice feedback to the menu interaction.
// TODO(petemill): If this wasn't a chromium module, we'd simply add a handler // for scrolling away, or have the menu change selection as we scroll.
|
||
// Templates | ||
BravePatching.RegisterPolymerTemplateModifications({ | ||
'settings-ui': (templateContent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for other reviewers: the keys here (ex: settings-ui
) are the names of components on the page 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback left! Awesome job on this. Would love to re-review when it's ready, just hit me up 😄
Button style was changed before this PR, so can be addressed separately.
The implementation of this will be more involved, which warrants reprioritization and not delaying this one IMO. The complication is that it will require template modification for the As with other things, I decided to draw the line somewhere considering the size of this PR and the need to improve the current state of the page, so there were some things that were more minor and will be follow-ups:
I'll look at the other issues @bsclifton brought up - I wasn't experiencing some of them after yesterday's rebase, so maybe they're introduced by today's rebase. |
The design mockup did have those icons in the titles but after giving it some thought, I think we should hold off on them. It's not a great UI pattern (in particular for a settings page vs a marketing page) and makes scanning the content quickly quite a bit more difficult. |
@rossmoody that decision seems timely! Please add the comment to brave/brave-browser#3797 if not already |
5d91ad4
to
3846f52
Compare
@bsclifton shields description padding has been increased, and @rossmoody 's style updates integrated. Watching PR builder and attempting to fix issues... |
1. Add a behavior to an existing Polymer JS component. This is similar to injecting a superclass which will receive the same lifecycle method calls. It could also be used to add properties and methods to the component, usable from the component's html template. 2. Modify an existing Polymer HTML template. When the component is registered, we provide the template DOM element which can be modified before it is cloned for use as content and attached to the document. 3. Inject style to any existing Polymer HTML component. By naming a module 'brave-override-style-my-module', the <style> element from that module will be taken and injected in to the existing 'my-module' component. 4. Replace icons in an existing iconset. This takes an icon from one existing iconset and replaces the content of an icon in another existing iconset. Can be used to replace a chromium icon with a brave icon. Whilst all this can be achieved via .patch files at sync / build time, this: - Keeps all the modifications functional. The advantage here is realized in the 100% inevitable and likely-common scenarios where the chromium webui implementations and underlying technology changes (e.g. html-modules vs es-modules, or simple module refactors). For some scenarios, we may be able to simply modify the central manipulation library (polymer_overrides.js). In more complicated scenarios, we will at least have all modifications functionally and individually labelled, making 'rebasing' potentially more straightforward than a .patch file with mixed intentions. - Maintains performance since these modifications are only performed once, whilst the component is being registered via the Polymer(component) function. Debugging: - Display (in verbose console log) how long it took to modify each Polymer template - Option to see timing of module and module-override registration (via hard-coded debug variable)
…n, re-organize other sections, and brave-styles Ensures each section shows and hides appropriately Fixes brave's custom sections showing up for all searches since they need a settings-section to be inside the settings/basic-page module. Also fixes some extra and missing borders between settings items.
…tings, Bookmarks, Downloads, History and Extensions Note that chrome://brave-resources/page_specific/X url-data-source is used for convenience. Technically these belong in //browser/resources and not //ui/resources, and served from, for example, chrome://bookmarks/X instead. However, the build setup neccessary to copy in to the chromium build output directory before the PAK and Vulcanize process is a lot of overhead for a couple lines of simple css. In the future we may wish to do this setup.
Co-authored by: Ross Moody <fiftyfivehis@gmail.com>
Co-authored by: Pete Miller <miller.pete@gmail.com>
3846f52
to
d2daf7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++! 😎👌
WebUI: Settings & 4 different ways to override
Two main areas to this PR: The Settings page, and architectural changes to the way we modify chromium WebUIs.
WebUI Settings
Fix brave/brave-browser#958
Fix brave/brave-browser#960
Fix brave/brave-browser#955
Address brave/brave-browser#26 (this is more of an umbrella issue)
Fix brave/brave-browser#964
Fix brave/brave-browser#3444
Fix brave/brave-browser#3826
WebUI General overriding
Add a behavior to an existing Polymer JS component. This is similar to injecting a superclass which will receive the same lifecycle method calls. It could also be used to add properties and methods to the component, usable from the component's html template.
Modify an existing Polymer HTML template. When the component is registered, we provide the template DOM element which can be modified before it is cloned for use as content and attached to the document.
Inject style to any existing Polymer HTML component. By naming a module 'brave-override-style-my-module', the <style> element from that module will be taken and injected in to the existing 'my-module' component.
Replace icons in an existing iconset. This takes an icon from one existing iconset and replaces the content of an icon in another existing iconset. Can be used to replace a chromium icon with a brave icon.
Whilst all this can be achieved via .patch files at sync / build time, this new methodology:
Debugging:
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) onnpm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist: