fix(core/caesar): show SHIFT label by default
What changed, and why it matters
This commit is a small user-interface cleanup for the Trezor hardware wallet's 'Caesar' layout. It makes the on-screen 'SHIFT' label appear by default whenever the Shift button feature is active, instead of only showing it in the tutorial. The change removes a special override that the tutorial used and applies the same label everywhere. There is no security issue here.
No security action needed. Treat as a normal UI consistency fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes the shift_label field and with_shift_label() builder method from ButtonPage in core/embed/rust/src/ui/layout_caesar/component/page.rs. It then changes the left-button rendering logic so that whenever shift_active is true, the button text is always TR::buttons__shift (the ‘SHIFT’ label). The tutorial component no longer needs to call with_shift_label(). This is a consistency/refactoring change in UI button labeling.
Changed components
core/embed/rust/src/ui/layout_caesar/component/page.rscore/embed/rust/src/ui/layout_caesar/component/tutorial.rsInspect captured patch +9 / −24
### core/embed/rust/src/ui/layout_caesar/component/page.rs
@@ -2,7 +2,6 @@ use super::super::fonts;
use super::{
constant, theme, ButtonController, ButtonControllerMsg, ButtonDetails, ButtonLayout, ButtonPos,
};
-use crate::strutil::TString;
use crate::translations::TR;
use crate::ui::component::{
Child, Component, ComponentExt, Event, EventCtx, Pad, PageMsg, Paginate,
@@ -48,9 +47,6 @@ where
back_on_first_page: bool,
/// Whether the left button is being held as "Shift" (menu navigation only).
shift_active: bool,
- /// Text shown on the left button while "Shift" is held, see
- /// `with_shift_label`.
- shift_label: Option<TString<'static>>,
buttons: Child<ButtonController>,
}
@@ -70,7 +66,6 @@ where
menu_nav: None,
back_on_first_page: false,
shift_active: false,
- shift_label: None,
// Setting empty layout for now, we do not yet know the page count.
// Initial button layout will be set in `place()` after we can call
// `content.page_count()`.
@@ -117,14 +112,6 @@ where
self
}
- /// While "Shift" is held, the left button shows `label` instead of the
- /// bracketed icon (menu navigation only). Used by the tutorial, on the
- /// screen teaching "Shift".
- pub fn with_shift_label(mut self, label: TString<'static>) -> Self {
- self.shift_label = Some(label);
- self
- }
-
pub fn with_back_btn(mut self, btn_details: Option<ButtonDetails>) -> Self {
self.back_btn_details = btn_details;
self
@@ -200,17 +187,17 @@ where
has_next: bool,
) -> ButtonLayout {
// The bracketed left icon advertises "Shift", which is offered only when
- // there is somewhere to go back to. It stays while "Shift" is held.
+ // there is somewhere to go back to. While "Shift" is held, the left
+ // button shows "Shift" (pressed) instead.
let can_go_back = has_prev || self.back_on_first_page;
- let shift = can_go_back || self.shift_active;
- let btn_left = match (menu_nav, shift, self.shift_label) {
- (_, _, Some(label)) if self.shift_active => ButtonDetails::text(label)
+ let btn_left = match (menu_nav, can_go_back) {
+ _ if self.shift_active => ButtonDetails::text(TR::buttons__shift.into())
.with_font(fonts::FONT_NORMAL)
.with_shift(),
- (MenuNav::Menu | MenuNav::ChoiceMenu, false, _) => ButtonDetails::menu_icon(),
- (MenuNav::Menu | MenuNav::ChoiceMenu, true, _) => ButtonDetails::menu_shift_icon(),
- (MenuNav::Close, false, _) => ButtonDetails::cancel_icon(),
- (MenuNav::Close, true, _) => ButtonDetails::cancel_shift_icon(),
+ (MenuNav::Menu | MenuNav::ChoiceMenu, false) => ButtonDetails::menu_icon(),
+ (MenuNav::Menu | MenuNav::ChoiceMenu, true) => ButtonDetails::menu_shift_icon(),
+ (MenuNav::Close, false) => ButtonDetails::cancel_icon(),
+ (MenuNav::Close, true) => ButtonDetails::cancel_shift_icon(),
};
let btn_right = if self.shift_active {
can_go_back.then(ButtonDetails::scroll_up_wide)
### core/embed/rust/src/ui/layout_caesar/component/tutorial.rs
@@ -70,8 +70,7 @@ enum ContentMsg {
/// the information screen or the tutorial menu instead.
///
/// Added elsewhere only for the tutorial: `ButtonPage::with_middle_btn`,
-/// `ButtonPage::with_shift_label`, `ButtonDetails::ghost` and
-/// `ButtonDetails::with_pressed_arm`.
+/// `ButtonDetails::ghost` and `ButtonDetails::with_pressed_arm`.
pub struct Tutorial {
screen: Screen,
/// Where `Screen::MenuInfo` goes back to
@@ -213,7 +212,6 @@ impl Tutorial {
text(&[TR::tutorial__hold_left_press_right])
.with_menu_nav(MenuNav::ChoiceMenu)
.with_back_on_first_page()
- .with_shift_label(TR::buttons__shift.into())
.with_confirm_btn(Some(ButtonDetails::ghost())),
),
Screen::Remember => framed(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.