public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH yew-widget-toolkit 0/4] small cleanups/fixes
@ 2026-07-17 12:55 Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 1/4] widget: form: radio button: fix property comments Dominik Csapak
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-07-17 12:55 UTC (permalink / raw)
  To: yew-devel

some smaller cleanups/fixes for the radio button and one for dom/align.

Dominik Csapak (4):
  widget: form: radio button: fix property comments
  widget: form: radio button: dim boxlabel when disabled
  widget: form: radio button: use 'radio' aria role instead of
    'checkbox'
  dom: align: fix fallback check for placements

 src/dom/align.rs                |  7 +++----
 src/widget/form/radio_button.rs | 14 +++++++++-----
 2 files changed, 12 insertions(+), 9 deletions(-)

-- 
2.47.3





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH yew-widget-toolkit 1/4] widget: form: radio button: fix property comments
  2026-07-17 12:55 [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Dominik Csapak
@ 2026-07-17 12:55 ` Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 2/4] widget: form: radio button: dim boxlabel when disabled Dominik Csapak
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-07-17 12:55 UTC (permalink / raw)
  To: yew-devel

They were copied from the checkbox, but not updated. Change the
'checkbox' mentions to 'radio button'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/form/radio_button.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/widget/form/radio_button.rs b/src/widget/form/radio_button.rs
index 753a71c..1f409c2 100644
--- a/src/widget/form/radio_button.rs
+++ b/src/widget/form/radio_button.rs
@@ -69,14 +69,14 @@ pub struct RadioButton {
     ///
     /// Called on user interaction:
     ///
-    /// - Click on the checkbox.
+    /// - Click on the radio button.
     /// - Click on the associated input label.
     /// - Activation by keyboard (space press).
     #[builder_cb(IntoEventCallback, into_event_callback, String)]
     #[prop_or_default]
     pub on_input: Option<Callback<String>>,
 
-    /// A right side label for the checkbox, to display additional information
+    /// A right side label for the radio button, to display additional information
     #[prop_or_default]
     pub box_label: Option<FieldLabel>,
 }
@@ -102,7 +102,7 @@ impl RadioButton {
 
     /// Method to set the box label.
     ///
-    /// A right side label for the checkbox to display additional information
+    /// A right side label for the radio buton to display additional information
     pub fn set_box_label(&mut self, box_label: impl Into<FieldLabel>) {
         self.box_label = Some(box_label.into());
     }
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH yew-widget-toolkit 2/4] widget: form: radio button: dim boxlabel when disabled
  2026-07-17 12:55 [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 1/4] widget: form: radio button: fix property comments Dominik Csapak
@ 2026-07-17 12:55 ` Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 3/4] widget: form: radio button: use 'radio' aria role instead of 'checkbox' Dominik Csapak
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-07-17 12:55 UTC (permalink / raw)
  To: yew-devel

Fix it the same way as in the checkbox, where it was recently fixed.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/form/radio_button.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/widget/form/radio_button.rs b/src/widget/form/radio_button.rs
index 1f409c2..3620add 100644
--- a/src/widget/form/radio_button.rs
+++ b/src/widget/form/radio_button.rs
@@ -282,7 +282,11 @@ impl ManagedField for RadioButtonField {
                 .into_html_with_ref(self.node_ref.clone()),
         );
 
-        let box_label = props.box_label.clone().map(|label| label.padding_start(2));
+        let box_label = props.box_label.clone().map(|label| {
+            label
+                .padding_start(2)
+                .class(disabled.then_some("pwt-opacity-disabled"))
+        });
 
         let checkbox = Row::new()
             .class(AlignItems::Center)
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH yew-widget-toolkit 3/4] widget: form: radio button: use 'radio' aria role instead of 'checkbox'
  2026-07-17 12:55 [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 1/4] widget: form: radio button: fix property comments Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 2/4] widget: form: radio button: dim boxlabel when disabled Dominik Csapak
@ 2026-07-17 12:55 ` Dominik Csapak
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 4/4] dom: align: fix fallback check for placements Dominik Csapak
  2026-07-17 21:59 ` applied: [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-07-17 12:55 UTC (permalink / raw)
  To: yew-devel

According to MDN[0], this is the correct aria role for a radio button.

0: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/radio_role

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/form/radio_button.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widget/form/radio_button.rs b/src/widget/form/radio_button.rs
index 3620add..ab3ffb8 100644
--- a/src/widget/form/radio_button.rs
+++ b/src/widget/form/radio_button.rs
@@ -276,7 +276,7 @@ impl ManagedField for RadioButtonField {
                     "tabindex",
                     props.input_props.tabindex.unwrap_or(0).to_string(),
                 )
-                .attribute("role", "checkbox")
+                .attribute("role", "radio")
                 .attribute("aria-checked", checked.then_some("true"))
                 .onkeyup(onkeyup)
                 .into_html_with_ref(self.node_ref.clone()),
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH yew-widget-toolkit 4/4] dom: align: fix fallback check for placements
  2026-07-17 12:55 [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Dominik Csapak
                   ` (2 preceding siblings ...)
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 3/4] widget: form: radio button: use 'radio' aria role instead of 'checkbox' Dominik Csapak
@ 2026-07-17 12:55 ` Dominik Csapak
  2026-07-17 21:59 ` applied: [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-07-17 12:55 UTC (permalink / raw)
  To: yew-devel

'try_fit_rect' takes a 'has_fallback' parameter, and it was intended
that this is false only for the last placement in the list.

Since `skip(1)` was done before `enumerate()`, the index was off by one.
Also the index is always smaller than `len()` so we have to compensate
by 1 for that.

Fix this by changing the order of `enumerate` and `skip` so the index is
the 'correct' one, and add +1 before checking against the length.

While at it, reuse `num_placements` instead of calculating the length
again.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/dom/align.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/dom/align.rs b/src/dom/align.rs
index a20cc6e..7d7fea8 100644
--- a/src/dom/align.rs
+++ b/src/dom/align.rs
@@ -480,16 +480,15 @@ where
     );
 
     // try fallback placements if the first one does not fit
-    if options.placements.len() > 1 && !fits(&rect, &window_rect, &options.placements[0].direction)
-    {
-        for (idx, placement) in options.placements.iter().skip(1).enumerate() {
+    if num_placements > 1 && !fits(&rect, &window_rect, &options.placements[0].direction) {
+        for (idx, placement) in options.placements.iter().enumerate().skip(1) {
             let new_rect = try_fit_rect(
                 &base,
                 &element,
                 &window_rect,
                 placement,
                 options.offset,
-                idx < num_placements,
+                idx + 1 < num_placements,
             );
 
             if fits(&new_rect, &window_rect, &placement.direction) {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* applied: [PATCH yew-widget-toolkit 0/4] small cleanups/fixes
  2026-07-17 12:55 [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Dominik Csapak
                   ` (3 preceding siblings ...)
  2026-07-17 12:55 ` [PATCH yew-widget-toolkit 4/4] dom: align: fix fallback check for placements Dominik Csapak
@ 2026-07-17 21:59 ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2026-07-17 21:59 UTC (permalink / raw)
  To: yew-devel, Dominik Csapak

On Fri, 17 Jul 2026 14:55:27 +0200, Dominik Csapak wrote:
> some smaller cleanups/fixes for the radio button and one for dom/align.
> 
> Dominik Csapak (4):
>   widget: form: radio button: fix property comments
>   widget: form: radio button: dim boxlabel when disabled
>   widget: form: radio button: use 'radio' aria role instead of
>     'checkbox'
>   dom: align: fix fallback check for placements
> 
> [...]

Applied, thanks!

[1/4] widget: form: radio button: fix property comments
      commit: aad60daea7249d0856890814105989296b1dd5b6
[2/4] widget: form: radio button: dim boxlabel when disabled
      commit: 139e75ee89da41060d5863c2325cf272623c918b
[3/4] widget: form: radio button: use 'radio' aria role instead of 'checkbox'
      commit: 675cda18d67ac73f845b7c7633effcc5e1b8b387
[4/4] dom: align: fix fallback check for placements
      commit: 792bb99eefb58beafc52c0a17a24bc685cc94d63




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-17 21:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 12:55 [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Dominik Csapak
2026-07-17 12:55 ` [PATCH yew-widget-toolkit 1/4] widget: form: radio button: fix property comments Dominik Csapak
2026-07-17 12:55 ` [PATCH yew-widget-toolkit 2/4] widget: form: radio button: dim boxlabel when disabled Dominik Csapak
2026-07-17 12:55 ` [PATCH yew-widget-toolkit 3/4] widget: form: radio button: use 'radio' aria role instead of 'checkbox' Dominik Csapak
2026-07-17 12:55 ` [PATCH yew-widget-toolkit 4/4] dom: align: fix fallback check for placements Dominik Csapak
2026-07-17 21:59 ` applied: [PATCH yew-widget-toolkit 0/4] small cleanups/fixes Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal