Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5ecc54f
feat(linux-grid): mark a field's key, edit and type in the row details
sedax90 Nov 8, 2026
d0f125b
docs(linux-grid): add the changelog entry
sedax90 Nov 8, 2026
bb9fc32
feat(linux-grid): search the row details' fields and show the edited …
sedax90 Nov 8, 2026
69e32e5
docs(linux-grid): add the changelog entry
sedax90 Nov 8, 2026
f743a96
fix(linux-grid): name a field's key and type to screen readers and dr…
datlechin Nov 8, 2026
faaf93d
Merge branch 'feat/linux-row-detail-fields' into feat/linux-row-detai…
datlechin Nov 8, 2026
d83d8ba
fix(linux-grid): add a symbolic type marker to row details
datlechin Nov 8, 2026
9e863bd
fix(linux-grid): compare accessible field text as strings
datlechin Nov 8, 2026
c3431d7
Merge branch 'feat/linux-row-detail-fields' into feat/linux-row-detai…
datlechin Nov 8, 2026
22e2078
fix(linux-grid): refresh row detail filters with their data
datlechin Nov 8, 2026
a34198c
fix(linux-grid): focus the row detail search when typing
datlechin Nov 8, 2026
4f0ee65
test(linux-grid): wait for row detail controls before tabbing
datlechin Nov 8, 2026
4ad9eca
feat(linux-grid): draw a row detail field as a name over its value, w…
sedax90 Nov 9, 2026
4f42a15
chore(linux): changelog for the row details design
sedax90 Nov 9, 2026
29d3819
feat(linux-grid): edit a row detail field in its own row
sedax90 Nov 9, 2026
cd69ecc
chore(linux): changelog for the inline row detail editor
sedax90 Nov 9, 2026
f168a84
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 9, 2026
2e485aa
fix(linux-grid): copy a row detail field's whole value through the gr…
datlechin Nov 9, 2026
a3fc9a0
Merge branch 'feat/linux-row-detail-design' into feat/linux-row-detai…
datlechin Nov 9, 2026
e47c3fd
refactor(linux-grid): seat the row detail value editor in its field's…
datlechin Nov 9, 2026
6f63a85
fix(linux-grid): hand the keyboard to a listed field when the editor'…
datlechin Nov 9, 2026
78baf3d
test(linux-grid): keep the row detail copy tests clear of other open …
datlechin Nov 9, 2026
ad50ddf
Merge branch 'feat/linux-row-detail-design' into feat/linux-row-detai…
datlechin Nov 9, 2026
19de849
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
b25a5a4
Merge commit '19de84965bbbe22ea705874e07f74fcd43c0d45b' into feat/lin…
datlechin Nov 10, 2026
3df0c59
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
29e8376
Merge commit '3df0c59abb8e17a0a606fccb0ca67f7a9037aaf5' into feat/lin…
datlechin Nov 10, 2026
ebf7cfa
fix(linux-grid): take the copy button before the tools box moves into…
datlechin Nov 10, 2026
934ffcc
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
8418c3c
Merge commit '934ffcce507a039463f61e8e3c0e496cac24fa77' into feat/lin…
datlechin Nov 10, 2026
d6bfc0f
fix(linux-grid): list a hidden row detail field the grid opens
datlechin Nov 10, 2026
9e33295
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linux/changelog.d/4157.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Row details edit a field in its own row instead of in an editor under the list.
129 changes: 115 additions & 14 deletions linux/crates/app/src/ui/data_grid/row_detail/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,30 @@ fn field_row() -> gtk::Box {
.build();
content.append(&top);
content.append(&value);
// A suffix of the row, as on a libadwaita property row.
let copy = gtk::Button::builder()
.icon_name(icons::EDIT_COPY)
.valign(gtk::Align::Center)
.build();
let copy = gtk::Button::from_icon_name(icons::EDIT_COPY);
copy.add_css_class("flat");
crate::ui::a11y::describe_icon_button(&copy, &gettext("Copy Value"), None);
// The value editor's pickers, while this is the picked field.
let tools = gtk::Box::builder().visible(false).build();
// Suffixes of the row, as on a libadwaita property row.
let suffix = gtk::Box::builder().valign(gtk::Align::Center).build();
suffix.append(&tools);
suffix.append(&copy);
let line = gtk::Box::new(gtk::Orientation::Horizontal, 6);
line.append(&content);
line.append(&suffix);
// The value editor, in place of the value, while this is the picked field.
let slot = gtk::Box::builder().visible(false).build();
let row = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.spacing(6)
.margin_top(6)
.margin_bottom(6)
.margin_start(12)
.margin_end(12)
.build();
row.append(&content);
row.append(&copy);
row.append(&line);
row.append(&slot);
row
}

Expand All @@ -168,26 +176,45 @@ struct FieldParts {
edited: gtk::Image,
kind: gtk::Label,
value: gtk::Inscription,
tools: gtk::Box,
copy: gtk::Button,
slot: gtk::Box,
}

fn field_parts(row: &gtk::Widget) -> Option<FieldParts> {
let content = row.first_child()?;
let line = row.first_child()?;
let content = line.first_child()?;
let top = content.first_child()?;
let key = top.first_child()?;
let name = key.next_sibling()?;
let edited = name.next_sibling()?;
let kind = edited.next_sibling()?.last_child()?;
let tools = content.next_sibling()?.first_child()?;
let copy = tools.next_sibling()?;
Some(FieldParts {
key: key.downcast().ok()?,
name: name.downcast().ok()?,
edited: edited.downcast().ok()?,
kind: kind.downcast().ok()?,
value: top.next_sibling()?.downcast().ok()?,
copy: content.next_sibling()?.downcast().ok()?,
tools: tools.downcast().ok()?,
copy: copy.downcast().ok()?,
slot: line.next_sibling()?.downcast().ok()?,
})
}

/// Move `widget` into `home`, unless it is there already: taking it out
/// would drop the keyboard it holds.
fn move_into(widget: &gtk::Box, home: &gtk::Box) {
if widget.parent().as_ref() == Some(home.upcast_ref()) {
return;
}
if let Some(parent) = widget.parent().and_downcast::<gtk::Box>() {
parent.remove(widget);
}
home.append(widget);
}

fn set_class(widget: &impl IsA<gtk::Widget>, class: &str, on: bool) {
match on {
true => widget.as_ref().add_css_class(class),
Expand Down Expand Up @@ -318,17 +345,20 @@ impl RowDetailPane {
if let Some(item) = item.downcast_ref::<gtk::ListItem>() {
pane.imp().bound.borrow_mut().push(item.clone());
pane.draw_field(item);
pane.place_editor();
}
}
));
factory.connect_unbind(glib::clone!(
#[weak(rename_to = pane)]
self,
move |_, item| pane
.imp()
.bound
.borrow_mut()
.retain(|bound| bound.upcast_ref::<glib::Object>() != item)
move |_, item| {
pane.imp()
.bound
.borrow_mut()
.retain(|bound| bound.upcast_ref::<glib::Object>() != item);
pane.place_editor();
}
));
factory
}
Expand All @@ -343,6 +373,7 @@ impl RowDetailPane {

pub(super) fn refilter_fields(&self) {
let imp = self.imp();
let editor_had_keyboard = self.editor_holds_focus();
let has_edits = self.grid().zip(self.current_row()).is_some_and(|(grid, row)| {
grid.grid_columns().iter().any(|column| {
let mark = grid.tracked().mark(&row, column.index);
Expand All @@ -360,6 +391,8 @@ impl RowDetailPane {
0 => "empty",
_ => "fields",
});
self.place_editor();
self.keep_keyboard(editor_had_keyboard);
}

fn field_shown(&self, column: Option<usize>) -> bool {
Expand Down Expand Up @@ -477,17 +510,31 @@ impl RowDetailPane {
return;
};
self.take_field(column);
self.place_editor();
self.load_value();
self.move_grid_focus(column);
}

/// Show `column`'s field, selected in the list, as the grid asks.
pub(super) fn set_field(&self, column: usize) {
self.take_field(column);
self.list_field(column);
self.select_in_list(Some(column));
self.place_editor();
self.load_value();
}

// The editor sits only in a listed field's row.
fn list_field(&self, column: usize) {
let imp = self.imp();
if self.current_row().is_none() || self.field_shown(Some(column)) {
return;
}
imp.field_search.set_text("");
imp.edited_toggle.set_active(false);
self.refilter_fields();
}

/// Make `column` the selected field. What was typed in another field
/// is committed first.
pub(super) fn take_field(&self, column: usize) {
Expand All @@ -510,11 +557,62 @@ impl RowDetailPane {
let syncing = imp.syncing.replace(true);
imp.selection.set_selected(position);
imp.syncing.set(syncing);
self.place_editor();
if position != gtk::INVALID_LIST_POSITION {
imp.field_list.scroll_to(position, gtk::ListScrollFlags::NONE, None);
}
}

/// Lay the value editor into the picked field's row, in place of its
/// value, and its pickers beside that row's copy button. The list
/// recycles rows as it scrolls and filters, so every bind and unbind
/// lays them again, and with no row for them they go back to the dock.
fn place_editor(&self) {
let imp = self.imp();
let picked = imp.field.get();
let bound: Vec<gtk::ListItem> = imp.bound.borrow().clone();
let mut seat = None;
for item in &bound {
let Some(parts) = item.child().as_ref().and_then(field_parts) else {
continue;
};
let holds = picked.is_some() && item.is_selected() && field_of(item.item()) == picked;
parts.value.set_visible(!holds);
parts.tools.set_visible(holds);
parts.slot.set_visible(holds);
if holds {
seat = Some((parts.tools, parts.slot));
}
}
let dock = imp.editor_dock.get();
let (tools_home, editor_home) = seat.unwrap_or_else(|| (dock.clone(), dock));
move_into(&imp.editor_tools.get(), &tools_home);
move_into(&imp.editor_box.get(), &editor_home);
}

fn editor_holds_focus(&self) -> bool {
let imp = self.imp();
crate::ui::a11y::holds_focus(&imp.editor_box.get()) || crate::ui::a11y::holds_focus(&imp.editor_tools.get())
}

/// A filter or a new column set can take away the row that held the
/// editor and the keyboard with it, which GTK would hand to the
/// window's first control.
fn keep_keyboard(&self, editor_had_it: bool) {
let imp = self.imp();
let list = imp.field_list.get();
if !editor_had_it || self.current_row().is_none() || imp.editor_box.is_ancestor(&list) {
return;
}
if imp.filtered.n_items() == 0 {
imp.field_search.grab_focus();
return;
}
// The list's focused row was the one taken away.
list.scroll_to(0, gtk::ListScrollFlags::FOCUS, None);
list.grab_focus();
}

/// Move the grid's focused cell to `column` of the shown row. The
/// list holds the keyboard, and `scroll_to` only marks the cell the
/// grid focuses next while the grid does not, so the keyboard stays
Expand Down Expand Up @@ -580,6 +678,7 @@ impl RowDetailPane {
return;
}
let items: Vec<glib::BoxedAnyObject> = wanted.into_iter().map(glib::BoxedAnyObject::new).collect();
let editor_had_keyboard = self.editor_holds_focus();
imp.syncing.set(true);
store.splice(0, store.n_items(), &items);
imp.syncing.set(false);
Expand All @@ -588,6 +687,8 @@ impl RowDetailPane {
imp.field.set(None);
}
self.select_in_list(imp.field.get());
self.place_editor();
self.keep_keyboard(editor_had_keyboard);
}

fn watch_column_visibility(&self) {
Expand Down
6 changes: 5 additions & 1 deletion linux/crates/app/src/ui/data_grid/row_detail/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ pub struct RowDetailPane {
#[template_child]
pub edited_toggle: TemplateChild<gtk::ToggleButton>,
#[template_child]
pub field_label: TemplateChild<gtk::Label>,
pub editor_dock: TemplateChild<gtk::Box>,
#[template_child]
pub editor_tools: TemplateChild<gtk::Box>,
#[template_child]
pub editor_box: TemplateChild<gtk::Box>,
#[template_child]
pub choice_button: TemplateChild<gtk::MenuButton>,
#[template_child]
Expand Down
34 changes: 29 additions & 5 deletions linux/crates/app/src/ui/data_grid/row_detail/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,39 @@ impl RowDetailPane {
return;
}
self.render();
let view = self.imp().value_view.get();
if crate::ui::a11y::holds_focus(&self.imp().value_view.get()) {
return;
}
self.reveal_editor();
// The pane may only now be on its way to the screen.
if !view.grab_focus() {
glib::idle_add_local_once(move || {
view.grab_focus();
});
if !self.grab_value() {
glib::idle_add_local_once(glib::clone!(
#[weak(rename_to = pane)]
self,
move || {
pane.grab_value();
}
));
}
}

/// A list builds a row only as it lays it out, which a pane opening
/// now has not done yet. Focusing the picked field's row makes the
/// list build it at once, so the editor has its row to sit in.
fn reveal_editor(&self) {
let imp = self.imp();
let position = imp.selection.selected();
if position != gtk::INVALID_LIST_POSITION {
imp.field_list.scroll_to(position, gtk::ListScrollFlags::FOCUS, None);
}
}

/// Only in its field's row: in the dock it would take keys unseen.
fn grab_value(&self) -> bool {
let imp = self.imp();
imp.editor_box.is_ancestor(&imp.field_list.get()) && imp.value_view.grab_focus()
}

/// Commit what was typed in the value editor before the grid writes
/// its rows. A value the column refuses goes, since it was never a
/// pending change.
Expand Down
78 changes: 78 additions & 0 deletions linux/crates/app/src/ui/data_grid/row_detail/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,84 @@ fn tab_leaves_the_field_list_after_the_focused_field() {
wait_until(WAIT, || !crate::ui::a11y::holds_focus(&list)).expect("Tab out of the list");
}

fn field_row_of(pane: &RowDetailPane, column: usize) -> gtk::Widget {
drawn_field(pane, column).child().expect("the field's row")
}

fn shows_value(pane: &RowDetailPane, column: usize) -> bool {
descendants(&field_row_of(pane, column))
.into_iter()
.filter_map(|widget| widget.downcast::<gtk::Inscription>().ok())
.any(|value| value.is_visible())
}

#[gtk4::test]
fn the_value_editor_sits_in_the_picked_fields_row() {
let (grid, pane) = opened(three_text_columns(), three_text_values());
let imp = pane.imp();
grid.focus(0, 1);
drain_main_context();

assert!(
imp.editor_box.is_ancestor(&field_row_of(&pane, 1)),
"the editor is not in its field's row"
);
assert!(imp.editor_tools.is_ancestor(&field_row_of(&pane, 1)));
assert!(
!shows_value(&pane, 1),
"the picked field drew its value beside the editor"
);
assert!(shows_value(&pane, 2));

grid.focus(0, 2);
drain_main_context();

assert!(
imp.editor_box.is_ancestor(&field_row_of(&pane, 2)),
"the editor did not follow the field"
);
assert!(!imp.editor_box.is_ancestor(&field_row_of(&pane, 1)));
assert!(shows_value(&pane, 1), "the field left behind lost its value");
assert_eq!(pane.typed_text(), "x");
}

#[gtk4::test]
fn a_field_the_search_drops_while_editing_hands_the_keyboard_to_the_search() {
let (grid, pane) = opened(three_text_columns(), three_text_values());
edit_field(&grid, &pane, 0, 2);
search_fields(&pane, "x");
assert_eq!(listed_columns(&pane), vec![2]);
assert!(crate::ui::a11y::holds_focus(&pane.imp().value_view.get()));

type_value(&pane, "z");
assert!(press_in_value(&pane, gdk::Key::Return, gdk::ModifierType::CONTROL_MASK));
drain_main_context();

assert_eq!(pending(&grid, 1, 2), Some(text("z")));
assert!(listed_columns(&pane).is_empty());
assert!(
crate::ui::a11y::holds_focus(&pane.imp().field_search.get()),
"the keyboard left the pane with the field's row"
);
}

#[gtk4::test]
fn a_field_the_search_hides_lists_again_when_the_grid_shows_it() {
let (grid, pane) = opened(three_text_columns(), three_text_values());
let imp = pane.imp();
grid.focus(0, 1);
search_fields(&pane, "note");
assert_eq!(listed_columns(&pane), vec![2]);

grid.grid.show_details_for(1);
wait_until(WAIT, || imp.editor_box.is_ancestor(&imp.field_list.get())).expect("the editor takes a row");

assert!(imp.field_search.text().is_empty(), "the search still hides the field");
assert_eq!(listed_columns(&pane), vec![0, 1, 2]);
assert!(imp.editor_box.is_ancestor(&field_row_of(&pane, 1)));
assert_eq!(pane.typed_text(), "A");
}

#[gtk4::test]
fn every_control_in_the_pane_is_named() {
let (grid, pane) = opened(two_text_columns(), two_text_values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ impl RowDetailPane {
buffer.place_cursor(&buffer.start_iter());
let view = imp.value_view.get();
view.set_editable(content.message.is_none());
imp.field_label.set_label(name);
view.update_property(&[gtk::accessible::Property::Label(name)]);
self.show_message(content.message.as_deref(), false);
imp.calendar_button.set_visible(content.calendar);
Expand Down
Loading
Loading