Skip to content

Commit

Permalink
Add hamburger menu on small screens (#16388)
Browse files Browse the repository at this point in the history
Reenable hamburger menu on small screens
  • Loading branch information
fallaciousreasoning committed Jun 1, 2023
1 parent d4c764b commit e6b5026
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
14 changes: 12 additions & 2 deletions browser/resources/settings/brave_overrides/settings_ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,19 @@ RegisterStyleOverride(
--brave-settings-menu-width: var(--settings-menu-width);
--brave-settings-menu-margin: 12px;
}
cr-drawer {
display: none !important;
/** Styling tweaks for the settings-menu when we display it inside the
* drawer. */
cr-drawer settings-menu {
--brave-settings-menu-margin-v: 0;
--brave-settings-menu-padding: 24px;
--brave-settings-menu-margin: 0;
}
cr-drawer settings-menu::part(header) {
display: none;
}
#container {
/* menu and content next to each other in the horizontal center */
justify-content: center;
Expand Down
23 changes: 23 additions & 0 deletions ui/webui/resources/br_elements/br_toolbar/br_toolbar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<link rel="stylesheet" href="chrome://resources/brave/fonts/poppins.css">
<style include="br-shared-style">
#menuButtonContainer {
position: absolute;
left: 0;
top: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}

#menuButton {
--cr-icon-button-fill-color: currentColor;
}

.br-toolbar {
--toolbar-background: var(--brave-toolbar-gradient);
background: var(--toolbar-background);
Expand Down Expand Up @@ -101,6 +115,15 @@

</style>
<div class$="br-toolbar [[fontsLoadedClassName]]">
<template is="dom-if" if="[[showMenu]]">
<div id="menuButtonContainer">
<cr-icon-button id="menuButton"
iron-icon="cr20:menu" on-click="onMenuTap_"
aria-label$="[[menuLabel]]"
title="[[menuLabel]]">
</cr-icon-button>
</div>
</template>
<ul class="nav-items" role="navigation" aria-label="Category navigation">
<li class="nav-items-list-item" title="[[settingsTitle]]">
<a class$="nav-item [[getNavItemSelectedClassName('settings')]]" href="chrome://settings">
Expand Down
17 changes: 13 additions & 4 deletions ui/webui/resources/br_elements/br_toolbar/br_toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,26 @@ Polymer({

/** @private */
onMenuTap_: function() {
console.debug('[br_toolbar] Not Implemented: onMenuTap_')
this.dispatchEvent(new CustomEvent(
'cr-toolbar-menu-tap', {bubbles: true, composed: true}))
},

focusMenuButton() {
console.debug('[br_toolbar] Not Implemented: focusMenuButton')
requestAnimationFrame(() => {
// Wait for next animation frame in case dom-if has not applied yet and
// added the menu button.
const menuButton =
this.shadowRoot!.querySelector<HTMLElement>('#menuButton');
if (menuButton) {
menuButton.focus();
}
});
},

/** @return {boolean} */
isMenuFocused() {
console.debug('[br_toolbar] Not Implemented: isMenuFocused (no menuButton)')
return false;
return !!this.shadowRoot!.activeElement &&
this.shadowRoot!.activeElement.id === 'menuButton';
},

/** @private */
Expand Down

0 comments on commit e6b5026

Please sign in to comment.