From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 76C591FF136 for ; Mon, 23 Mar 2026 09:54:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 94CA9DC38; Mon, 23 Mar 2026 09:54:43 +0100 (CET) Message-ID: <69d92e99-e63d-42bf-a6fd-d4395fbd5c9b@proxmox.com> Date: Mon, 23 Mar 2026 09:54:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH yew-widget-toolkit 2/2] widget: form: number: allow focusing the input on click To: yew-devel@lists.proxmox.com, Dietmar Maurer References: <20260319170432.1533393-1-c.heiss@proxmox.com> <20260319170432.1533393-3-c.heiss@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20260319170432.1533393-3-c.heiss@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774256003580 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.041 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 3Q2SUWNH52V2AEANV7BAGDMTCOFWC5P6 X-Message-ID-Hash: 3Q2SUWNH52V2AEANV7BAGDMTCOFWC5P6 X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: @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 > --- > 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 ManagedField for NumberField { > } > }); > > - 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 ManagedField for NumberField { > event.prevent_default(); > } > }) > - .onmousedown(on_mouse_down) > .into_html_with_ref(self.input_ref.clone()); > > let mut input_container = Tooltip::empty()