public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
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	[thread overview]
Message-ID: <20261006172617.3125465-1-t.lamprecht@proxmox.com> (raw)

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 <t.lamprecht@proxmox.com>
---
 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<S: DataStore + 'static> Component for PwtGridPicker<S> {
             .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





             reply	other threads:[~2026-10-06 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 17:25 Thomas Lamprecht [this message]
2026-10-07  6:37 ` applied: [PATCH] widget: grid picker: scroll the selected entry into view on open 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=20261006172617.3125465-1-t.lamprecht@proxmox.com \
    --to=t.lamprecht@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 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