Constrain the paragraph Tabs action row to the form width

Wrap the action buttons against the offered form width. Keep the accessibility lookup and pointer-click regression at both viewport sizes, and assert that the click target is inside the viewport.
This commit is contained in:
FredApps authored and GitHub committed 2026-11-29 09:34:32 +01:00
1 parent 6f3703bbab
commit 452bf2013d
2 files changed
+8 -2

No files matched your search

@@ -609,7 +609,9 @@ fn tabs_buttons(unit: Unit) -> Param {
let (rows, _, _) = tab_rows(fields);
let can_add = new_tab_position(&rows, unit).is_some();
let (mut add, mut delete, mut clear) = (false, false, false);
let line = Row::new().wrap(true).show(ui, |ui, _| {
// Wrap against the form's offered width rather than measuring an intrinsic-width
// strip that may be clipped by the property group on small screens.
let line = Row::new().fill_width().wrap(true).show(ui, |ui, _| {
add = clicked(&Button::new(tl!("Add")).enabled(can_add).show(ui));
delete = clicked(&Button::new(tl!("Delete Tab")).enabled(!rows.is_empty()).show(ui));
clear = clicked(&Button::new(tl!("Clear All Tabs")).enabled(!rows.is_empty()).show(ui));
@@ -576,9 +576,13 @@ fn clear_all_tabs_can_be_clicked_in_a_narrow_viewport() {
}
let out = frame(&mut app, vec![]);
let nodes = out.platform_output.accesskit_update.unwrap().nodes;
let clear = nodes.iter().find(|(_, node)| node.role() == Role::Button && node.label() == Some("Clear All Tabs")).unwrap();
let clear = nodes
.iter()
.find(|(_, node)| node.role() == Role::Button && node.label() == Some("Clear All Tabs"))
.unwrap_or_else(|| panic!("Clear All Tabs is missing at {width} points"));
let bounds = clear.1.bounds().unwrap();
let at = pos2(((bounds.x0 + bounds.x1) * 0.5) as f32, ((bounds.y0 + bounds.y1) * 0.5) as f32);
assert!(screen.contains(at), "Clear All Tabs at {bounds:?} is outside the {width}-point viewport");
assert_eq!(tab_rows(&app).len(), 2);
frame(&mut app, vec![Event::PointerMoved(at)]);