feat(core): add danger style to confirm_action
What changed, and why it matters
This commit is a user-interface styling change. It renames a parameter from 'hold_danger' to 'danger' and applies a warning/danger visual style (red/orange colors, warning icons) to screens that already required the user to hold a button to confirm risky actions like wiping the device or enabling experimental features. There is no change to security logic, cryptography, or how confirmations are enforced.
No security action required. This is a cosmetic UI refactor. Normal code review and QA for visual consistency are sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors the confirm_action UI API across Trezor’s Rust and Python firmware layers. It replaces the boolean hold_danger flag with a more general danger flag, updates the trait signature in FirmwareUI, and adjusts the Bolt, Caesar, Delizia, and Eckhart layouts so that danger styling (danger_header, button_actionbar_danger, warning icons, orange/red gradients) is applied when danger=True. The two production call sites that already used hold_danger—apply_settings.py (experimental features) and wipe_device.py (wipe device)—now pass danger=True. The actual hold-to-confirm interaction and cancellation behavior remain unchanged; only visual presentation is affected. The translations signatures.json update is a routine metadata refresh.
Changed components
core/embed/rust/src/ui/api/firmware_micropython.rscore/embed/rust/src/ui/layout_bolt/ui_firmware.rscore/embed/rust/src/ui/layout_caesar/ui_firmware.rscore/embed/rust/src/ui/layout_delizia/flow/confirm_action.rscore/embed/rust/src/ui/layout_delizia/ui_firmware.rscore/embed/rust/src/ui/layout_eckhart/ui_firmware.rscore/embed/rust/src/ui/ui_firmware.rscore/mocks/generated/trezorui_api.pyicore/src/apps/management/apply_settings.pycore/src/apps/management/wipe_device.pycore/src/trezor/ui/layouts/bolt/__init__.pycore/src/trezor/ui/layouts/caesar/__init__.pycore/src/trezor/ui/layouts/delizia/__init__.pycore/src/trezor/ui/layouts/eckhart/__init__.pycore/translations/signatures.jsonInspect captured patch +88 / −77
### core/embed/rust/librust_qstr.h
@@ -402,7 +402,6 @@ static void _librust_qstrs(void) {
MP_QSTR_haptics_enabled;
MP_QSTR_hint;
MP_QSTR_hold;
- MP_QSTR_hold_danger;
MP_QSTR_homescreen__backup_needed_info;
MP_QSTR_homescreen__click_to_connect;
MP_QSTR_homescreen__click_to_unlock;
### core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -61,7 +61,7 @@ extern "C" fn new_confirm_action(n_args: usize, args: *const Obj, kwargs: *mut M
.unwrap_or_else(|_| Obj::const_none())
.try_into_option()?;
let hold: bool = kwargs.get_or(Qstr::MP_QSTR_hold, false)?;
- let hold_danger: bool = kwargs.get_or(Qstr::MP_QSTR_hold_danger, false)?;
+ let danger: bool = kwargs.get_or(Qstr::MP_QSTR_danger, false)?;
let reverse: bool = kwargs.get_or(Qstr::MP_QSTR_reverse, false)?;
let prompt_screen: bool = kwargs.get_or(Qstr::MP_QSTR_prompt_screen, false)?;
let prompt_title: Option<TString> = kwargs
@@ -79,7 +79,7 @@ extern "C" fn new_confirm_action(n_args: usize, args: *const Obj, kwargs: *mut M
cancel,
verb_cancel,
hold,
- hold_danger,
+ danger,
reverse,
prompt_screen,
prompt_title,
@@ -1470,7 +1470,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// cancel: bool = True,
/// verb_cancel: str | None = None,
/// hold: bool = False,
- /// hold_danger: bool = False,
+ /// danger: bool = False, # unused on caesar
/// reverse: bool = False,
/// prompt_screen: bool = False,
/// prompt_title: str | None = None,
### core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
@@ -47,7 +47,7 @@ impl FirmwareUI for UIBolt {
_cancel: bool,
verb_cancel: Option<TString<'static>>,
hold: bool,
- hold_danger: bool,
+ danger: bool,
reverse: bool,
_prompt_screen: bool,
_prompt_title: Option<TString<'static>>,
@@ -74,7 +74,7 @@ impl FirmwareUI for UIBolt {
} else {
ButtonPage::new(paragraphs, theme::BG).with_cancel_confirm(verb_cancel, verb)
};
- if hold && hold_danger {
+ if danger {
page = page.with_confirm_style(theme::button_danger())
}
let layout = RootComponent::new(Frame::left_aligned(theme::label_title(), title, page));
### core/embed/rust/src/ui/layout_caesar/ui_firmware.rs
@@ -46,7 +46,7 @@ impl FirmwareUI for UICaesar {
_cancel: bool,
verb_cancel: Option<TString<'static>>,
hold: bool,
- _hold_danger: bool,
+ _danger: bool,
reverse: bool,
_prompt_screen: bool,
_prompt_title: Option<TString<'static>>,
### core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs
@@ -61,13 +61,9 @@ impl ConfirmActionStrings {
}
}
-pub enum HoldTheme {
- Normal,
- Danger,
-}
-
pub struct ConfirmActionOptions {
- pub hold: Option<HoldTheme>,
+ pub hold: bool,
+ pub danger: bool,
pub swipe_down: bool,
pub swipe_up: bool,
pub page_limit: Option<u16>,
@@ -78,7 +74,8 @@ pub struct ConfirmActionOptions {
impl ConfirmActionOptions {
pub fn new() -> Self {
Self {
- hold: None,
+ hold: false,
+ danger: false,
swipe_down: false,
swipe_up: false,
page_limit: None,
@@ -88,12 +85,12 @@ impl ConfirmActionOptions {
}
pub fn with_hold(mut self, hold: bool) -> Self {
- self.hold = if hold { Some(HoldTheme::Normal) } else { None };
+ self.hold = hold;
self
}
- pub fn with_hold_danger(mut self) -> Self {
- self.hold = Some(HoldTheme::Danger);
+ pub fn with_danger(mut self, danger: bool) -> Self {
+ self.danger = danger;
self
}
@@ -288,7 +285,7 @@ pub fn new_confirm_action(
verb_cancel: Option<TString<'static>>,
reverse: bool,
hold: bool,
- hold_danger: bool,
+ danger: bool,
prompt_screen: bool,
prompt_title: TString<'static>,
external_menu: bool,
@@ -309,18 +306,12 @@ pub fn new_confirm_action(
paragraphs.into_paragraphs()
};
- if external_menu && (prompt_screen || hold || hold_danger) {
+ if external_menu && (prompt_screen || hold) {
return Err(Error::ValueError(
c"external_menu currently not supported in tandem with prompt_screen/hold",
));
}
- let mut options = ConfirmActionOptions::new();
- options = if hold_danger {
- options.with_hold_danger()
- } else {
- options.with_hold(hold)
- };
new_confirm_action_simple(
paragraphs,
if external_menu {
@@ -329,7 +320,9 @@ pub fn new_confirm_action(
ConfirmActionExtra::Menu(ConfirmActionMenuStrings::new().with_verb_cancel(verb_cancel))
},
ConfirmActionStrings::new(title, subtitle, None, prompt_screen.then_some(prompt_title)),
- options,
+ ConfirmActionOptions::new()
+ .with_hold(hold)
+ .with_danger(danger),
)
}
@@ -340,12 +333,8 @@ fn new_confirm_action_uni<T: Component + Paginate + MaybeTrace + 'static>(
strings: ConfirmActionStrings,
options: ConfirmActionOptions,
) -> Result<SwipeFlow, Error> {
- let (prompt_screen, prompt_pages, mut flow, page) = create_flow(
- strings.title,
- strings.prompt_screen,
- options.hold.is_some(),
- &extra,
- );
+ let (prompt_screen, prompt_pages, mut flow, page) =
+ create_flow(strings.title, strings.prompt_screen, options.hold, &extra);
let header = Header::left_aligned(strings.title);
let has_external_menu = matches!(extra, ConfirmActionExtra::ExternalMenu);
@@ -354,6 +343,9 @@ fn new_confirm_action_uni<T: Component + Paginate + MaybeTrace + 'static>(
ConfirmActionExtra::Menu(_) => header.with_menu_button(),
ConfirmActionExtra::Cancel => header.with_cancel_button(),
};
+ if options.danger {
+ header = danger_header(header);
+ }
if let Some(subtitle) = strings.subtitle {
header = header.with_subtitle(subtitle);
}
@@ -411,6 +403,7 @@ fn new_confirm_action_uni<T: Component + Paginate + MaybeTrace + 'static>(
&extra,
strings.subtitle,
options.hold,
+ options.danger,
prompt_title,
prompt_state,
)?;
@@ -485,27 +478,33 @@ fn create_confirm(
flow: &mut SwipeFlow,
extra: &ConfirmActionExtra,
subtitle: Option<TString<'static>>,
- hold: Option<HoldTheme>,
+ hold: bool,
+ danger: bool,
prompt_title: TString<'static>,
prompt_state: &'static dyn FlowController,
) -> Result<(), Error> {
- let (prompt, prompt_action) = if let Some(hold) = hold {
- let prompt = match hold {
- HoldTheme::Normal => PromptScreen::new_hold_to_confirm(),
- HoldTheme::Danger => PromptScreen::new_hold_to_confirm_danger(),
- };
- (prompt, TR::instructions__hold_to_confirm.into())
- } else {
- (
+ let (prompt, prompt_action) = match (hold, danger) {
+ (true, false) => (
+ PromptScreen::new_hold_to_confirm(),
+ TR::instructions__hold_to_confirm.into(),
+ ),
+ (true, true) => (
+ PromptScreen::new_hold_to_confirm_danger(),
+ TR::instructions__hold_to_confirm.into(),
+ ),
+ (false, _) => (
PromptScreen::new_tap_to_confirm(),
TR::instructions__tap_to_confirm.into(),
- )
+ ),
};
let mut header = Header::left_aligned(prompt_title);
if matches!(extra, ConfirmActionExtra::Menu(_)) {
header = header.with_menu_button();
}
+ if danger {
+ header = danger_header(header);
+ }
if let Some(subtitle) = subtitle {
header = header.with_subtitle(subtitle);
}
@@ -520,6 +519,12 @@ fn create_confirm(
Ok(())
}
+fn danger_header(header: Header) -> Header {
+ header
+ .with_static_icon(theme::ICON_WARNING, theme::ORANGE_LIGHT)
+ .styled(theme::label_title_danger())
+}
+
#[inline(never)]
pub fn new_confirm_action_simple<T: Component + Paginate + MaybeTrace + 'static>(
content: T,
### core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
@@ -55,7 +55,7 @@ impl FirmwareUI for UIDelizia {
_cancel: bool,
verb_cancel: Option<TString<'static>>,
hold: bool,
- hold_danger: bool,
+ danger: bool,
reverse: bool,
prompt_screen: bool,
prompt_title: Option<TString<'static>>,
@@ -69,7 +69,7 @@ impl FirmwareUI for UIDelizia {
if external_menu { None } else { verb_cancel },
reverse,
hold,
- hold_danger,
+ danger,
prompt_screen,
prompt_title.unwrap_or(TString::empty()),
external_menu,
### core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs
@@ -56,7 +56,7 @@ impl FirmwareUI for UIEckhart {
cancel: bool,
_verb_cancel: Option<TString<'static>>,
hold: bool,
- hold_danger: bool,
+ danger: bool,
reverse: bool,
_prompt_screen: bool,
_prompt_title: Option<TString<'static>>,
@@ -80,27 +80,34 @@ impl FirmwareUI for UIEckhart {
)
};
- let right_button = match (hold, verb) {
- (true, verb) => {
- let verb = verb.unwrap_or(TR::buttons__hold_to_confirm.into());
- let (style, gradient) = if hold_danger {
- (button_actionbar_danger(), theme::Gradient::Alert)
- } else {
- (button_confirm(), theme::Gradient::SignGreen)
- };
- Button::with_text(verb)
- .with_long_press(theme::CONFIRM_HOLD_DURATION)
- .with_long_press_danger(hold_danger)
- .with_gradient(gradient)
- .styled(style)
- }
- (false, Some(verb)) => Button::with_text(verb),
- (false, None) => {
- Button::with_text(TR::buttons__confirm.into()).styled(button_confirm())
- }
+ let default_verb = if hold {
+ TR::buttons__hold_to_confirm
+ } else {
+ TR::buttons__confirm
+ };
+ let mut right_button = Button::with_text(verb.unwrap_or(default_verb.into()));
+ if hold {
+ right_button = right_button
+ .with_long_press(theme::CONFIRM_HOLD_DURATION)
+ .with_long_press_danger(danger);
+ }
+ let right_button = match (danger, hold, verb) {
+ (true, _, _) => right_button
+ .styled(button_actionbar_danger())
+ .with_gradient(Gradient::Alert),
+ (false, true, _) => right_button
+ .styled(button_confirm())
+ .with_gradient(Gradient::SignGreen),
+ (false, false, None) => right_button.styled(button_confirm()),
+ (false, false, Some(_)) => right_button,
};
let mut header = Header::new(title);
+ if danger {
+ header = header
+ .with_icon(theme::ICON_WARNING, theme::ORANGE)
+ .with_text_style(theme::label_title_danger());
+ }
if external_menu {
header = header.with_right_button(Button::with_icon(theme::ICON_MENU), HeaderMsg::Menu);
}
### core/embed/rust/src/ui/ui_firmware.rs
@@ -142,7 +142,7 @@ pub trait FirmwareUI {
cancel: bool,
verb_cancel: Option<TString<'static>>,
hold: bool,
- hold_danger: bool,
+ danger: bool,
reverse: bool,
prompt_screen: bool,
prompt_title: Option<TString<'static>>,
### core/mocks/generated/trezorui_api.pyi
@@ -156,7 +156,7 @@ def confirm_action(
cancel: bool = True,
verb_cancel: str | None = None,
hold: bool = False,
- hold_danger: bool = False,
+ danger: bool = False, # unused on caesar
reverse: bool = False,
prompt_screen: bool = False,
prompt_title: str | None = None,
### core/src/apps/management/apply_settings.py
@@ -276,7 +276,7 @@ async def _require_confirm_experimental_features(enable: bool) -> None:
br_code=BRT_PROTECT_CALL,
prompt_screen=True,
hold=True,
- hold_danger=True,
+ danger=True,
)
### core/src/apps/management/wipe_device.py
@@ -29,7 +29,7 @@ async def wipe_device(msg: WipeDevice) -> None:
reverse=True,
verb=TR.buttons__hold_to_confirm,
hold=True,
- hold_danger=True,
+ danger=True,
br_code=ButtonRequestType.WipeDevice,
)
### core/src/trezor/ui/layouts/bolt/__init__.py
@@ -39,7 +39,7 @@ async def confirm_action(
verb: str | None = None,
verb_cancel: str | None = None,
hold: bool = False,
- hold_danger: bool = False,
+ danger: bool = False,
reverse: bool = False,
exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_CODE_OTHER,
@@ -54,7 +54,7 @@ async def confirm_action(
verb=verb,
verb_cancel=verb_cancel,
hold=hold,
- hold_danger=hold_danger,
+ danger=danger,
reverse=reverse,
) as layout:
return await raise_if_not_confirmed(
### core/src/trezor/ui/layouts/caesar/__init__.py
@@ -66,7 +66,7 @@ async def confirm_action(
verb: str | None = None,
verb_cancel: str | None = "",
hold: bool = False,
- hold_danger: bool = False,
+ danger: bool = False, # unused on caesar
reverse: bool = False,
exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_CODE_OTHER,
### core/src/trezor/ui/layouts/delizia/__init__.py
@@ -45,7 +45,7 @@ async def confirm_action(
verb: str | None = None,
verb_cancel: str | None = None,
hold: bool = False,
- hold_danger: bool = False,
+ danger: bool = False,
reverse: bool = False,
exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_CODE_OTHER,
@@ -62,7 +62,7 @@ async def confirm_action(
verb=verb,
verb_cancel=verb_cancel,
hold=hold,
- hold_danger=hold_danger,
+ danger=danger,
reverse=reverse,
prompt_screen=prompt_screen,
prompt_title=prompt_title or title,
### core/src/trezor/ui/layouts/eckhart/__init__.py
@@ -47,7 +47,7 @@ async def confirm_action(
verb: str | None = None,
verb_cancel: str | None = None,
hold: bool = False,
- hold_danger: bool = False,
+ danger: bool = False,
reverse: bool = False,
exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_CODE_OTHER,
@@ -62,7 +62,7 @@ async def confirm_action(
verb=verb,
cancel=False,
hold=hold,
- hold_danger=hold_danger,
+ danger=danger,
reverse=reverse,
prompt_screen=prompt_screen,
prompt_title=prompt_title or title,
### core/translations/signatures.json
@@ -1,8 +1,8 @@
{
"current": {
- "merkle_root": "9ff3e8675b0e42299ea45651b82b3ce8ff8436bb4fac9ce88267b21da5a13e7b",
- "datetime": "2026-10-27T10:14:59.399089+00:00",
- "commit": "5a07622a57ef5d08e1677c729ab065d0143bdffe"
+ "merkle_root": "69206bcde48213e21e353ea178277ab48218feb216baf9692b26b00853c74667",
+ "datetime": "2026-10-27T16:03:49.984983+00:00",
+ "commit": "224524e81bb39655837d61144f0f968cd10a3932"
},
"history": [
{Why this scored 15/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.