From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id A03391FF0AA for ; Tue, 06 Oct 2026 19:26:38 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 485CB20B18; Tue, 06 Oct 2026 19:26:38 +0200 (CEST) From: Thomas Lamprecht To: yew-devel@lists.proxmox.com Subject: [PATCH] widget: grid picker: scroll the selected entry into view on open Date: Tue, 6 Oct 2026 19:25:30 +0200 Message-ID: <20261006172617.3125465-1-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791307587012 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.623 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: RYQ6DNHPL7FBEN5VUUUUQQJ3PTCKCRJH X-Message-ID-Hash: RYQ6DNHPL7FBEN5VUUUUQQJ3PTCKCRJH X-MailFrom: t.lamprecht@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: When a picker opens, its table scrolls its own viewport to the selected entry. That only works while the table is limited to the picker's height. Since the combobox stopped giving its table the pwt-fit class, nothing limits it: as a flex item it keeps its content height, so it grows to the height of all rows and the picker's outer container scrolls instead. The table then considers every row visible and never scrolls. With 30 or more entries, where rows are rendered on demand, the selected entry is not even rendered when the dropdown tries to focus it, so a picker like the time zone selector always opened at the top of the list. Let the table shrink to the remaining picker height in the grid picker itself, so this works for every picker and not only for the combobox. As a side effect, virtual scrolling takes effect for long lists instead of rendering every row, and the filter row stays in place while the list scrolls. Pickers whose table still sets pwt-fit behave as before. Fixes: 5e37ff7fd87d ("Combobox: avoid use of pwt-fit (not needed)") Signed-off-by: Thomas Lamprecht --- src/widget/grid_picker.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widget/grid_picker.rs b/src/widget/grid_picker.rs index caf6a187..b40ac922 100644 --- a/src/widget/grid_picker.rs +++ b/src/widget/grid_picker.rs @@ -188,6 +188,9 @@ impl Component for PwtGridPicker { .cell_configuration(CellConfiguration::new().class("pwt-datatable-cell pwt-pointer")) .hover(true) .header_focusable(false) + // Let the table shrink to fit the picker, so it scrolls itself and can bring the + // selected entry into view, instead of the whole picker scrolling. + .min_height(0) .selection(self.selection.clone()) .on_row_click({ let on_select = on_select.clone(); -- 2.47.3