* [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width
@ 2026-12-01 11:02 Shannon Sterz
2026-12-01 11:42 ` Dominik Csapak
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Shannon Sterz @ 2026-12-01 11:02 UTC (permalink / raw)
To: yew-devel
Icons have a fixed width of 16px in essentially all themes. 1rem is
equivalent to the font-size of the root element of the current
document. This varies by theme between 13 and 20px. So the icons here
aligned differently depending on the theme. Make the indent always
match the width of an icon to avoid that. This should improve
usability for deeply nested menus.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/widget/nav/navigation_drawer.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
index ab8ac2e8..491cccd4 100644
--- a/src/widget/nav/navigation_drawer.rs
+++ b/src/widget/nav/navigation_drawer.rs
@@ -264,7 +264,7 @@ impl PwtNavigationDrawer {
.onkeydown(onkeydown)
// add indentation
.with_optional_child((indent_level > 0).then(|| {
- html! {<span style={format!("width: {}rem", (indent_level as f32) * 1.0)}/>}
+ html! {<span style={format!("width: {}px", indent_level * 16)}/>}
}))
// add optional icon on the left
.with_optional_child(
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width
2026-12-01 11:02 [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width Shannon Sterz
@ 2026-12-01 11:42 ` Dominik Csapak
2026-12-01 12:27 ` Shannon Sterz
2026-12-01 12:48 ` Superseded: " Shannon Sterz
2026-12-01 14:21 ` applied: " Thomas Lamprecht
2 siblings, 1 reply; 6+ messages in thread
From: Dominik Csapak @ 2026-12-01 11:42 UTC (permalink / raw)
To: Shannon Sterz, yew-devel
hi,
it's probably an improvement overall, but I'd like to not
hardcode the theme sizes here in the code.
Another way to do this would be to define a css variable
for the navigation icons size, e.g.
--nav-icon-font-size
which could be used here:
`width: calc(var(--nav-icon-font-size) * {});`
(or having a class that uses a --ident-level css variable
which we set as style)
wdyt ?
On 12/1/26 12:03 PM, Shannon Sterz wrote:
> Icons have a fixed width of 16px in essentially all themes. 1rem is
> equivalent to the font-size of the root element of the current
> document. This varies by theme between 13 and 20px. So the icons here
> aligned differently depending on the theme. Make the indent always
> match the width of an icon to avoid that. This should improve
> usability for deeply nested menus.
>
> Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
> ---
> src/widget/nav/navigation_drawer.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
> index ab8ac2e8..491cccd4 100644
> --- a/src/widget/nav/navigation_drawer.rs
> +++ b/src/widget/nav/navigation_drawer.rs
> @@ -264,7 +264,7 @@ impl PwtNavigationDrawer {
> .onkeydown(onkeydown)
> // add indentation
> .with_optional_child((indent_level > 0).then(|| {
> - html! {<span style={format!("width: {}rem", (indent_level as f32) * 1.0)}/>}
> + html! {<span style={format!("width: {}px", indent_level * 16)}/>}
> }))
> // add optional icon on the left
> .with_optional_child(
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width
2026-12-01 11:42 ` Dominik Csapak
@ 2026-12-01 12:27 ` Shannon Sterz
0 siblings, 0 replies; 6+ messages in thread
From: Shannon Sterz @ 2026-12-01 12:27 UTC (permalink / raw)
To: Dominik Csapak, yew-devel
On Tue Dec 1, 2026 at 12:42 PM CET, Dominik Csapak wrote:
> hi,
>
> it's probably an improvement overall, but I'd like to not
> hardcode the theme sizes here in the code.
>
> Another way to do this would be to define a css variable
> for the navigation icons size, e.g.
>
> --nav-icon-font-size
>
> which could be used here:
>
> `width: calc(var(--nav-icon-font-size) * {});`
> (or having a class that uses a --ident-level css variable
> which we set as style)
>
> wdyt ?
mainly wanted to send a minimal patch here so avoided that. but sure we
can take that approach instead. ill send patches for that in a minute.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Superseded: Re: [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width
2026-12-01 11:02 [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width Shannon Sterz
2026-12-01 11:42 ` Dominik Csapak
@ 2026-12-01 12:48 ` Shannon Sterz
2026-12-01 14:21 ` applied: " Thomas Lamprecht
2 siblings, 0 replies; 6+ messages in thread
From: Shannon Sterz @ 2026-12-01 12:48 UTC (permalink / raw)
To: Shannon Sterz, yew-devel
superseded-by: https://lore.proxmox.com/yew-devel/20261201124753.176304-1-s.sterz@proxmox.com/T/#t
On Tue Dec 1, 2026 at 12:02 PM CET, Shannon Sterz wrote:
> Icons have a fixed width of 16px in essentially all themes. 1rem is
> equivalent to the font-size of the root element of the current
> document. This varies by theme between 13 and 20px. So the icons here
> aligned differently depending on the theme. Make the indent always
> match the width of an icon to avoid that. This should improve
> usability for deeply nested menus.
>
> Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
> ---
> src/widget/nav/navigation_drawer.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
> index ab8ac2e8..491cccd4 100644
> --- a/src/widget/nav/navigation_drawer.rs
> +++ b/src/widget/nav/navigation_drawer.rs
> @@ -264,7 +264,7 @@ impl PwtNavigationDrawer {
> .onkeydown(onkeydown)
> // add indentation
> .with_optional_child((indent_level > 0).then(|| {
> - html! {<span style={format!("width: {}rem", (indent_level as f32) * 1.0)}/>}
> + html! {<span style={format!("width: {}px", indent_level * 16)}/>}
> }))
> // add optional icon on the left
> .with_optional_child(
^ permalink raw reply [flat|nested] 6+ messages in thread
* applied: [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width
2026-12-01 11:02 [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width Shannon Sterz
2026-12-01 11:42 ` Dominik Csapak
2026-12-01 12:48 ` Superseded: " Shannon Sterz
@ 2026-12-01 14:21 ` Thomas Lamprecht
2026-12-01 14:33 ` Thomas Lamprecht
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Lamprecht @ 2026-12-01 14:21 UTC (permalink / raw)
To: yew-devel, Shannon Sterz
On Tue, 01 Dec 2026 12:02:50 +0100, Shannon Sterz wrote:
> Icons have a fixed width of 16px in essentially all themes. 1rem is
> equivalent to the font-size of the root element of the current
> document. This varies by theme between 13 and 20px. So the icons here
> aligned differently depending on the theme. Make the indent always
> match the width of an icon to avoid that. This should improve
> usability for deeply nested menus.
>
> [...]
Applied, thanks!
[1/1] widget: navigation drawer: match menu item indents with the icon width
commit: 585106e58f6113f5d393a300e875f3da841d2115
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: applied: [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width
2026-12-01 14:21 ` applied: " Thomas Lamprecht
@ 2026-12-01 14:33 ` Thomas Lamprecht
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2026-12-01 14:33 UTC (permalink / raw)
To: yew-devel, Shannon Sterz
Am 01.12.26 um 15:21 schrieb Thomas Lamprecht:
> On Tue, 01 Dec 2026 12:02:50 +0100, Shannon Sterz wrote:
>> Icons have a fixed width of 16px in essentially all themes. 1rem is
>> equivalent to the font-size of the root element of the current
>> document. This varies by theme between 13 and 20px. So the icons here
>> aligned differently depending on the theme. Make the indent always
>> match the width of an icon to avoid that. This should improve
>> usability for deeply nested menus.
>>
>> [...]
>
> Applied, thanks!
>
> [1/1] widget: navigation drawer: match menu item indents with the icon width
> commit: 585106e58f6113f5d393a300e875f3da841d2115
sorry, I had this locally already applied before Dominik's reply and did not
recheck the list since then. Will try to fleece in v2.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-01 14:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 11:02 [PATCH yew-widget-toolkit] widget: navigation drawer: match menu item indents with the icon width Shannon Sterz
2026-12-01 11:42 ` Dominik Csapak
2026-12-01 12:27 ` Shannon Sterz
2026-12-01 12:48 ` Superseded: " Shannon Sterz
2026-12-01 14:21 ` applied: " Thomas Lamprecht
2026-12-01 14:33 ` Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox