all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com, Dietmar Maurer <dietmar@proxmox.com>
Subject: Re: [PATCH yew-widget-toolkit 2/2] widget: form: number: allow focusing the input on click
Date: Mon, 23 Mar 2026 09:54:09 +0100	[thread overview]
Message-ID: <69d92e99-e63d-42bf-a6fd-d4395fbd5c9b@proxmox.com> (raw)
In-Reply-To: <20260319170432.1533393-3-c.heiss@proxmox.com>

@Dietmar

i applied this one since it fixed the focus issue for nubmer fields.
Looking at the code this slipped in with the changes to the managedfield
interface, but the commit message (and code) don't give a full 
explanation for this onmousedown handler.
(only 'prevent focus loss')

Can you remember in what situations we lost the focus or where there
were problems? Since i couldn't find any...

On 3/19/26 6:04 PM, Christoph Heiss wrote:
> The `.prevent_default()` on the input elements `onmousedown` handler is
> not needed and actually prevents the input from being focused by
> clicking, since the event will never reach it. Drop it.
> 
> The returned `SpinnerStop` value is just a dummy, so safe to remove the
> entire handler.
> 
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
>   src/widget/form/number.rs | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/src/widget/form/number.rs b/src/widget/form/number.rs
> index 6db7063..82d66b4 100644
> --- a/src/widget/form/number.rs
> +++ b/src/widget/form/number.rs
> @@ -665,12 +665,6 @@ impl<T: NumberTypeInfo> ManagedField for NumberField<T> {
>               }
>           });
>   
> -        let on_mouse_down = ctx.link().callback(|event: MouseEvent| {
> -            // prevent focus loss
> -            event.prevent_default();
> -            Msg::SpinnerStop // dummy
> -        });
> -
>           let input_props = props.input_props.clone();
>   
>           let inputmode = if T::is_decimal() {
> @@ -702,7 +696,6 @@ impl<T: NumberTypeInfo> ManagedField for NumberField<T> {
>                       event.prevent_default();
>                   }
>               })
> -            .onmousedown(on_mouse_down)
>               .into_html_with_ref(self.input_ref.clone());
>   
>           let mut input_container = Tooltip::empty()





  reply	other threads:[~2026-03-23  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 17:04 [PATCH yew-widget-toolkit 0/2] widget: form: number: fix float display and focus Christoph Heiss
2026-03-19 17:04 ` [RFC PATCH yew-widget-toolkit 1/2] widget: form: number: round floats to nearest step value Christoph Heiss
2026-03-23  8:51   ` Dominik Csapak
2026-03-25 12:09     ` Christoph Heiss
2026-03-19 17:04 ` [PATCH yew-widget-toolkit 2/2] widget: form: number: allow focusing the input on click Christoph Heiss
2026-03-23  8:54   ` Dominik Csapak [this message]
2026-03-23 10:43     ` Dietmar Maurer
2026-03-23  8:50 ` partially applied: [PATCH yew-widget-toolkit 0/2] widget: form: number: fix float display and focus Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69d92e99-e63d-42bf-a6fd-d4395fbd5c9b@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=dietmar@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal