What changed, and why it matters
This commit fixes how long text is shown on Trezor Safe 3 and similar devices using the 'Bolt' user interface. Previously, long messages in confirmation dialogs could be cut off or not fully visible. Now these dialogs can paginate (split across multiple swipeable pages) so users can read the entire content before approving. The change is a UI/UX improvement rather than a direct exploit fix, but truncated security warnings could theoretically lead users to confirm something they did not fully see.
Treat as a hardening/UI-correctness fix. Review whether any security-critical modal previously relied on text that could be truncated, and verify that paginated pages cannot be bypassed without user acknowledgment. No immediate incident response is indicated.
Security signals we found
UI truncation/pagination behavior changed for security-relevant confirmation dialogs
Long translations could previously overflow visible dialog area
Modal confirmation buttons now appear on paginated pages, requiring user interaction per page
Test changes explicitly reference 'long translations may not fit on a single page' for Bolt layout
Evidence from the diff
The patch refactors IconDialog in the Bolt UI layout to support pagination when placed inside a ButtonPage container. It introduces new_paginated(), a Paginate implementation, and PageBreaking::Cut text styles so long title/value/description text flows across pages instead of being clipped. ButtonPage gains a without_content_spacing() option and adjusted rendering logic for single-page vs. multi-page layouts. The firmware’s new_show_modal() now wraps CancelAndConfirm, CancelAndText, and ConfirmText modals in a paginated ButtonPage with a Border. Tests are updated to swipe through multi-page Bolt dialogs before clicking OK.
Changed components
core/embed/rust/src/ui/layout_bolt/component/dialog.rscore/embed/rust/src/ui/layout_bolt/component/page.rscore/embed/rust/src/ui/layout_bolt/ui_firmware.rstests/click_tests/reset.pytests/click_tests/test_pin.pytests/click_tests/test_reset_bip39.pytests/input_flows.pyInspect captured patch +153 / −55
### core/embed/rust/src/ui/layout_bolt/component/dialog.rs
@@ -4,10 +4,11 @@ use crate::ui::component::image::BlendedImage;
use crate::ui::component::text::paragraphs::{
Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt,
};
-use crate::ui::component::text::TextStyle;
-use crate::ui::component::{Child, Component, Event, EventCtx, Never};
+use crate::ui::component::text::{PageBreaking, TextStyle};
+use crate::ui::component::{Child, Component, Empty, Event, EventCtx, Never, Paginate};
use crate::ui::geometry::{Insets, LinearPlacement, Rect};
use crate::ui::shape::Renderer;
+use crate::ui::util::Pager;
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
pub enum DialogMsg<T, U> {
@@ -80,10 +81,17 @@ where
}
}
+// Text styles of a paginated `IconDialog`, see `IconDialog::style`.
+const TEXT_DEMIBOLD_CUT: TextStyle = theme::TEXT_DEMIBOLD.with_page_breaking(PageBreaking::Cut);
+const TEXT_NORMAL_OFF_WHITE_CUT: TextStyle =
+ theme::TEXT_NORMAL_OFF_WHITE.with_page_breaking(PageBreaking::Cut);
+const TEXT_MONO_DATA_CUT: TextStyle = theme::TEXT_MONO_DATA.with_page_breaking(PageBreaking::Cut);
+
pub struct IconDialog<U> {
image: Option<Child<BlendedImage>>,
paragraphs: Paragraphs<ParagraphVecShort<'static>>,
controls: Child<U>,
+ allow_pagination: bool,
}
impl<U> IconDialog<U>
@@ -94,9 +102,19 @@ where
icon: BlendedImage,
title: Option<impl Into<TString<'static>>>,
controls: U,
+ ) -> Self {
+ Self::new_inner(icon, title, controls, false)
+ }
+
+ fn new_inner(
+ icon: BlendedImage,
+ title: Option<impl Into<TString<'static>>>,
+ controls: U,
+ allow_pagination: bool,
) -> Self {
let (image, paragraphs) = if let Some(title) = title {
- let title = Paragraph::new(&theme::TEXT_DEMIBOLD, title).centered();
+ let style = Self::style(allow_pagination, &theme::TEXT_DEMIBOLD, &TEXT_DEMIBOLD_CUT);
+ let title = Paragraph::new(style, title).centered();
let para = ParagraphVecShort::from_iter([title]);
(Some(Child::new(icon)), para)
} else {
@@ -110,6 +128,22 @@ where
.with_spacing(Self::VALUE_SPACE),
),
controls: Child::new(controls),
+ allow_pagination,
+ }
+ }
+
+ /// When paginating, the container signals that the content continues
+ /// (scrollbar, "next page" button), so the text doesn't need to mark the
+ /// page breaks.
+ fn style(
+ allow_pagination: bool,
+ style: &'static TextStyle,
+ paginated_style: &'static TextStyle,
+ ) -> &'static TextStyle {
+ if allow_pagination {
+ paginated_style
+ } else {
+ style
}
}
@@ -127,11 +161,21 @@ where
}
pub fn with_description(self, description: impl Into<TString<'static>>) -> Self {
- self.with_text(&theme::TEXT_NORMAL_OFF_WHITE, description)
+ let style = Self::style(
+ self.allow_pagination,
+ &theme::TEXT_NORMAL_OFF_WHITE,
+ &TEXT_NORMAL_OFF_WHITE_CUT,
+ );
+ self.with_text(style, description)
}
pub fn with_value(self, value: impl Into<TString<'static>>) -> Self {
- self.with_text(&theme::TEXT_MONO_DATA, value)
+ let style = Self::style(
+ self.allow_pagination,
+ &theme::TEXT_MONO_DATA,
+ &TEXT_MONO_DATA_CUT,
+ );
+ self.with_text(style, value)
}
pub fn new_shares(lines: [impl Into<TString<'static>>; 4], controls: U) -> Self {
@@ -153,6 +197,7 @@ where
.into_paragraphs()
.with_placement(LinearPlacement::vertical().align_at_center()),
controls: Child::new(controls),
+ allow_pagination: false,
}
}
@@ -161,16 +206,30 @@ where
pub const VALUE_SPACE: i16 = 5;
}
+impl IconDialog<Empty> {
+ /// Dialog whose content can paginate. To be placed inside a paginating
+ /// container such as `ButtonPage`, which then supplies the controls and the
+ /// border insets.
+ pub fn new_paginated(icon: BlendedImage, title: Option<impl Into<TString<'static>>>) -> Self {
+ Self::new_inner(icon, title, Empty, true)
+ }
+}
+
impl<U> Component for IconDialog<U>
where
U: Component,
{
type Msg = DialogMsg<Never, U::Msg>;
fn place(&mut self, bounds: Rect) -> Rect {
- let bounds = bounds
- .inset(theme::borders())
- .inset(Insets::top(Self::ICON_AREA_PADDING));
+ // When paginating inside a container (e.g. `ButtonPage`), the border
+ // insets are supplied by the container.
+ let bounds = if self.allow_pagination {
+ bounds
+ } else {
+ bounds.inset(theme::borders())
+ };
+ let bounds = bounds.inset(Insets::top(Self::ICON_AREA_PADDING));
let controls_area = self.controls.place(bounds);
let content_area = bounds.inset(Insets::bottom(controls_area.height()));
@@ -201,6 +260,22 @@ where
}
}
+/// `IconDialog` can paginate its content when placed inside a paginating
+/// container such as `ButtonPage` (see `IconDialog::new_paginated`). The
+/// icon stays visible on all pages, only the text is paginated.
+impl<U> Paginate for IconDialog<U>
+where
+ U: Component,
+{
+ fn pager(&self) -> Pager {
+ self.paragraphs.pager()
+ }
+
+ fn change_page(&mut self, active_page: u16) {
+ self.paragraphs.change_page(active_page);
+ }
+}
+
#[cfg(feature = "ui_debug")]
impl<U> crate::trace::Trace for IconDialog<U>
where
### core/embed/rust/src/ui/layout_bolt/component/page.rs
@@ -39,6 +39,8 @@ pub struct ButtonPage<T> {
swipe_left: bool,
/// Whether to pass-through right swipe to parent component.
swipe_right: bool,
+ /// Vertical space between the content and the buttons.
+ content_spacing: i16,
/// Fade to given backlight level on next paint().
fade: Cell<Option<u8>>,
}
@@ -62,6 +64,7 @@ where
cancel_from_any_page: false,
swipe_left: false,
swipe_right: false,
+ content_spacing: theme::BUTTON_SPACING,
fade: Cell::new(None),
}
}
@@ -118,6 +121,14 @@ where
self
}
+ /// Let the content area extend all the way down to the buttons. Meant for
+ /// content which keeps its own distance from the buttons, e.g. vertically
+ /// centered text.
+ pub fn without_content_spacing(mut self) -> Self {
+ self.content_spacing = 0;
+ self
+ }
+
fn setup_swipe(&mut self) {
self.swipe.allow_up = self.scrollbar.has_next_page();
self.swipe.allow_down = self.scrollbar.has_previous_page();
@@ -287,7 +298,7 @@ where
_ => true,
},
};
- let layout = PageLayout::new(bounds, small_left_button);
+ let layout = PageLayout::new(bounds, small_left_button, self.content_spacing);
self.pad.place(bounds);
self.swipe.place(bounds);
self.button_cancel.place(layout.button_left);
@@ -387,7 +398,9 @@ where
}
if self.button_cancel.is_some() && self.is_cancel_visible() {
self.button_cancel.render(target);
- } else {
+ } else if !self.scrollbar.pager().is_single() {
+ // On a single page without cancel, the confirm button spans both
+ // button areas, so there is no space for the prev button.
self.button_prev.render(target);
}
if self.scrollbar.has_next_page() {
@@ -433,9 +446,9 @@ impl PageLayout {
const SCROLLBAR_WIDTH: i16 = 8;
const SCROLLBAR_SPACE: i16 = 5;
- pub fn new(area: Rect, small_left_button: bool) -> Self {
+ pub fn new(area: Rect, small_left_button: bool, content_spacing: i16) -> Self {
let (area, button_both) = area.split_bottom(theme::BUTTON_HEIGHT);
- let area = area.inset(Insets::bottom(theme::BUTTON_SPACING));
+ let area = area.inset(Insets::bottom(content_spacing));
let (_space, content) = area.split_left(theme::CONTENT_BORDER);
let (content_single_page, _space) = content.split_right(theme::CONTENT_BORDER);
let (content, scrollbar) =
### core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
@@ -1348,43 +1348,48 @@ fn new_show_modal(
.with_value(value)
.with_description(description),
)?,
- ModalButtons::CancelAndConfirm => LayoutObj::new(
- IconDialog::new(
- icon,
- title,
- Button::cancel_confirm(
- Button::with_icon(theme::ICON_CANCEL),
- Button::with_icon(theme::ICON_CONFIRM).styled(button_style),
- false,
- ),
+ // The button variants are paginated: the icon stays visible on all
+ // pages and only the text is paginated by `ButtonPage`. The `Border`
+ // keeps the whole dialog offset from the screen edges as before. The
+ // text is vertically centered, so like the non-paginated `IconDialog`
+ // it may span all the way down to the buttons.
+ ModalButtons::CancelAndConfirm => LayoutObj::new(Border::new(
+ theme::borders(),
+ ButtonPage::new(
+ IconDialog::new_paginated(icon, title)
+ .with_value(value)
+ .with_description(description),
+ theme::BG,
)
- .with_value(value)
- .with_description(description),
- )?,
- ModalButtons::CancelAndText(text) => LayoutObj::new(
- IconDialog::new(
- icon,
- title,
- Button::cancel_confirm(
- Button::with_icon(theme::ICON_CANCEL),
- Button::with_text(text).styled(button_style),
- false,
- ),
+ .without_content_spacing()
+ .with_cancel_confirm(None, None)
+ .with_confirm_style(button_style),
+ ))?,
+ ModalButtons::CancelAndText(text) => LayoutObj::new(Border::new(
+ theme::borders(),
+ ButtonPage::new(
+ IconDialog::new_paginated(icon, title)
+ .with_value(value)
+ .with_description(description),
+ theme::BG,
)
- .with_value(value)
- .with_description(description),
- )?,
- ModalButtons::ConfirmText(text) => LayoutObj::new(
- IconDialog::new(
- icon,
- title,
- theme::button_bar(Button::with_text(text).styled(button_style).map(|msg| {
- (matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
- })),
+ .without_content_spacing()
+ .with_cancel_confirm(None, Some(text))
+ .with_confirm_style(button_style),
+ ))?,
+ ModalButtons::ConfirmText(text) => LayoutObj::new(Border::new(
+ theme::borders(),
+ ButtonPage::new(
+ IconDialog::new_paginated(icon, title)
+ .with_value(value)
+ .with_description(description),
+ theme::BG,
)
- .with_value(value)
- .with_description(description),
- )?,
+ .without_content_spacing()
+ .with_cancel_confirm(None, Some(text))
+ .without_cancel()
+ .with_confirm_style(button_style),
+ ))?,
};
Ok(obj)
}
### tests/click_tests/reset.py
@@ -47,7 +47,12 @@ def confirm_new_wallet(debug: "DebugLink") -> None:
def confirm_read(debug: "DebugLink", middle_r: bool = False) -> None:
- if debug.layout_type in (LayoutType.Bolt, LayoutType.Eckhart):
+ if debug.layout_type is LayoutType.Bolt:
+ # long translations may not fit on a single page
+ for _ in range(debug.read_layout().page_count() - 1):
+ debug.swipe_up()
+ debug.click(debug.screen_buttons.ok())
+ elif debug.layout_type is LayoutType.Eckhart:
debug.click(debug.screen_buttons.ok())
elif debug.layout_type is LayoutType.Caesar:
page_count = debug.read_layout().page_count()
### tests/click_tests/test_pin.py
@@ -421,6 +421,10 @@ def test_wipe_code_same_as_pin(device_handler: "BackgroundDeviceHandler"):
with prepare(device_handler, Situation.WIPE_CODE_SETUP, old_pin="1") as debug:
_input_see_confirm(debug, "1")
# Try again
+ if debug.layout_type is LayoutType.Bolt:
+ # long translations may not fit on a single page
+ for _ in range(debug.read_layout().page_count() - 1):
+ debug.swipe_up()
go_next(debug)
_enter_two_times(debug, "2", "2")
### tests/click_tests/test_reset_bip39.py
@@ -23,7 +23,7 @@
from ..common import MOCK_GET_ENTROPY
from . import reset
-from .common import LayoutType, go_next
+from .common import LayoutType
if TYPE_CHECKING:
from trezorlib.testing.device_handler import BackgroundDeviceHandler
@@ -86,7 +86,7 @@ def test_reset_bip39(device_handler: "BackgroundDeviceHandler"):
# Your backup is done
if debug.layout_type is not LayoutType.Eckhart:
- go_next(debug)
+ reset.confirm_read(debug)
# TODO: some validation of the generated secret?
### tests/input_flows.py
@@ -2203,9 +2203,7 @@ def load_N_shares(
else:
raise RuntimeError
- br = yield
- assert br.code == B.Success
- assert br.name == "success_backup"
+ yield from swipe_if_necessary(debug, B.Success, "success_backup")
debug.press_yes()
return mnemonics
@@ -2241,9 +2239,7 @@ def load_N_groups(
raise RuntimeError
mnemonics.append(group_mnemonics)
- br = yield
- assert br.code == B.Success
- assert br.name == "success_backup"
+ yield from swipe_if_necessary(debug, B.Success, "success_backup")
debug.press_yes()
return mnemonicsWhy this scored 27/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.