@@ -90,8 +90,8 @@ const ANNOUNCEMENT_DELAY: Duration = Duration::from_millis(150);
9090
9191struct UiState {
9292 focus : NodeId ,
93- announcement : Option < String > ,
94- pending_announcement : Option < ( String , Instant ) > ,
93+ announcement : Option < & ' static str > ,
94+ pending_announcement : Option < ( & ' static str , Instant ) > ,
9595 scale_factor : f64 ,
9696 safe_area_inset : Vec2 ,
9797}
@@ -162,7 +162,7 @@ impl UiState {
162162 } ;
163163 // On iOS, VoiceOver announces the label of the activated button.
164164 // Postpone the live region update so the messages don't overlap.
165- self . pending_announcement = Some ( ( text. into ( ) , Instant :: now ( ) ) ) ;
165+ self . pending_announcement = Some ( ( text, Instant :: now ( ) ) ) ;
166166 }
167167
168168 fn flush_announcement ( & mut self , adapter : & mut Adapter ) -> bool {
@@ -173,9 +173,9 @@ impl UiState {
173173 return true ;
174174 }
175175 if let Some ( ( text, _) ) = self . pending_announcement . take ( ) {
176- self . announcement = Some ( text. clone ( ) ) ;
176+ self . announcement = Some ( text) ;
177177 adapter. update_if_active ( || {
178- let announcement = build_announcement ( & text) ;
178+ let announcement = build_announcement ( text) ;
179179 let root = self . build_root ( ) ;
180180 TreeUpdate {
181181 nodes : vec ! [ ( ANNOUNCEMENT_ID , announcement) , ( WINDOW_ID , root) ] ,
0 commit comments