public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH] widget: grid picker: scroll the selected entry into view on open
@ 2026-10-06 17:25 Thomas Lamprecht
  2026-10-07  6:37 ` applied: " Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Lamprecht @ 2026-10-06 17:25 UTC (permalink / raw)
  To: yew-devel

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





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

end of thread, other threads:[~2026-10-07  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 17:25 [PATCH] widget: grid picker: scroll the selected entry into view on open Thomas Lamprecht
2026-10-07  6:37 ` applied: " Dominik Csapak

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