Skip to content
This repository was archived by the owner on Oct 8, 2020. It is now read-only.

Commit ab4e0f1

Browse files
committed
fix menu options and voice visibility
1 parent 1b99ca5 commit ab4e0f1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/build-header.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ export class CustomHeader {
130130
header[button].querySelector('mwc-icon-button').style.display = 'none';
131131
}
132132
header[button].querySelector('ha-icon, ha-icon-button, paper-icon-button').style.height = '48px';
133-
const items = Array.from(header[button].querySelectorAll('paper-item'));
133+
const items = Array.from(header[button].querySelectorAll('mwc-list-item, paper-item'));
134134
items.forEach(item => {
135135
const index = items.indexOf(item);
136-
this.tapOrClick(item, this.ha_elem[button].querySelectorAll('paper-item')[index]);
136+
this.tapOrClick(item, this.ha_elem[button].querySelectorAll('mwc-list-item, paper-item')[index]);
137137
});
138138
} else {
139139
if (!this.ha_elem[button]) return;
@@ -168,7 +168,11 @@ export class CustomHeader {
168168
tapOrClick(listenElement, clickElement) {
169169
listenElement.setAttribute('onClick', ' ');
170170
listenElement.addEventListener('click', () => {
171-
clickElement.dispatchEvent(new MouseEvent('click', { bubbles: false, cancelable: false }));
171+
if (clickElement.nodeName === 'MWC-LIST-ITEM') {
172+
clickElement.click();
173+
} else {
174+
clickElement.dispatchEvent(new MouseEvent('click', { bubbles: false, cancelable: false }));
175+
}
172176
});
173177
}
174178
}

src/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class CustomHeaderConfig {
116116
if (config.show_tabs) config.show_tabs = processTabArray(config.show_tabs);
117117
if (config.show_tabs && config.show_tabs.length) config.hide_tabs = invertNumArray(config.show_tabs);
118118
if (config.disable_sidebar || config.menu_dropdown) config.menu_hide = true;
119-
if (config.voice_dropdown) config.voice_hide = true;
119+
if (config.voice_dropdown || !haElem.hass.config.components.includes('conversation')) config.voice_hide = true;
120120
if (config.header_text != undefined && config.header_text == '') {
121121
config.header_text = this.default_config.header_text;
122122
}

0 commit comments

Comments
 (0)