Conversation
37df705 to
5f010c7
Compare
| import { html } from "lit-html"; | ||
|
|
||
| @customElement("ha-clickable-list-item") | ||
| export class HaClickableListItem extends ListItem { |
There was a problem hiding this comment.
mwc-list-item doesn't like being wrapped inside anchor tags:
material-components/material-web#1095 (comment)
We have to extend ListItem to retain keyboard navigation behavior
a92a697 to
6bdd397
Compare
|
@zsarnett @bramkragten I think I'm ready for a first-pass review, and some code help if possible. Ideally, if you could focus first on the known regressions list I laid out in the PR description, that would be great as those are the areas giving me the most problems. I'm in the process of creating a 2nd cloud account for my local instance so you can eventually poke around on a live environment rather than pulling local. But it's taking forever for cloud to initiate so for now you should probably pull to poke around. Thank you! PS: I tried to remove as much unused CSS (and ts code that was only there for polymer) as I could but I'm sure there's more optimizations and simplifications that can be done. Feel free to point any out or ask if they're necessary. |
70c1751 to
c5edb48
Compare
src/components/ha-sidebar.ts
Outdated
| ${afterSpacer.map((panel) => | ||
| this._renderPanel( | ||
| panel.url_path, | ||
| panel.url_path === this.hass.defaultPanel |
There was a problem hiding this comment.
We should check for component_name === lovelace here, and not for defaultPanel
There was a problem hiding this comment.
Current master compares to defaultPanel. Is it wrong in master too then?
src/components/ha-sidebar.ts
Outdated
| ? panel.title || this.hass.localize("panel.states") | ||
| : this.hass.localize(`panel.${panel.title}`) || panel.title, | ||
| panel.icon, | ||
| panel.url_path === this.hass.defaultPanel && !panel.icon |
There was a problem hiding this comment.
Same here, panel.component_name === "lovelace"
There was a problem hiding this comment.
It looks like this.hass.defaultPanel is set to the constant "lovelace" already here: https://github.com/home-assistant/frontend/blob/dev/src/fake_data/provide_hass.ts#L200
Should I still use an explicit string here or should I do panel.component_name === this.hass.defaultPanel
src/components/ha-sidebar.ts
Outdated
| const elements = listbox.items; | ||
| const path = evt.composedPath(); | ||
|
|
||
| for (const pathItem of path as Node[]) { | ||
| let index = -1; | ||
| if (isNodeElement(pathItem) && isListItem(pathItem)) { | ||
| index = elements.indexOf(pathItem); | ||
| } | ||
|
|
||
| if (index !== -1) { | ||
| return index; | ||
| } | ||
| } | ||
|
|
||
| return -1; |
There was a problem hiding this comment.
Why not use?
| const elements = listbox.items; | |
| const path = evt.composedPath(); | |
| for (const pathItem of path as Node[]) { | |
| let index = -1; | |
| if (isNodeElement(pathItem) && isListItem(pathItem)) { | |
| index = elements.indexOf(pathItem); | |
| } | |
| if (index !== -1) { | |
| return index; | |
| } | |
| } | |
| return -1; | |
| return listbox.getIndexOfTarget(evt); |
There was a problem hiding this comment.
Because we use a extended mwc-list-item with a different name? Let's make an extended mwc-list that handles this. It doesn't belong in ha-sidebar.
There was a problem hiding this comment.
Yeah. That's probably for the best for a number of reasons, but going to be a non-trivial refactor. I'll get to that after Christmas then.
219f57f to
2048d9e
Compare
14b89cf to
5409752
Compare
|
This got into a bad git state apparently. I've recreated it here: #8052 |
Proposed change
Refactor sidebar to use
mwc-listinstead ofpaper-listbox.Previous attempt: #7326
Related PR: #7453
Known Regressions
Fixed regressions
In edit mode, you can only drag items by clicking in blank areas. Clicking on text or icon directly won't allow dragging.Text isn't bolded (is that a problem?)RTL Issues!importantto do it. Remainder may not be blocking?Slight border width inconsistency near utility panels:Arrow key navigation doesn't cycle to top from bottom or vice versaHidden panel list isn't separated from rest of listList item highlight bar now spans full width (is that a problem?)User Avatar circle too narrowNotification count badge explodes in collapsed view (and avatar circle is wrong):Icons are slightly too far to the left in collapsed viewType of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: