File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -195,14 +195,24 @@ function applySmtpComposePageHandlers() {
195195 if ( $ ( '.compose_cc' ) . val ( ) || $ ( '.compose_bcc' ) . val ( ) ) {
196196 toggle_recip_flds ( ) ;
197197 }
198+ // Handle focus management for different compose scenarios
198199 if ( window . location . href . search ( '&reply=1' ) !== - 1 || window . location . href . search ( '&reply_all=1' ) !== - 1 ) {
199200 replace_cursor_positon ( $ ( 'textarea[name="compose_body"]' ) ) ;
200201 }
201- if ( window . location . href . search ( '&forward=1' ) !== - 1 ) {
202+ else if ( window . location . href . search ( '&forward=1' ) !== - 1 ) {
203+ replace_cursor_positon ( $ ( 'textarea[name="compose_body"]' ) ) ;
202204 setTimeout ( function ( ) {
203205 save_compose_state ( ) ;
204206 } , 100 ) ;
205207 }
208+ else {
209+ var toField = $ ( '.compose_to' ) ;
210+ if ( toField . val ( ) . trim ( ) === '' ) {
211+ toField . focus ( ) ;
212+ } else {
213+ $ ( 'textarea[name="compose_body"]' ) . focus ( ) ;
214+ }
215+ }
206216 if ( $ ( '.sys_messages' ) . text ( ) != 'Message Sent' ) {
207217 get_smtp_profile ( $ ( '.compose_server' ) . val ( ) ) ;
208218 }
You can’t perform that action at this time.
0 commit comments