@@ -294,7 +294,6 @@ export class Compose extends FormElement {
294
294
private handleTabChanged ( ) {
295
295
const tabs = this . shadowRoot . querySelector ( 'temba-tabs' ) as TabPane ;
296
296
this . currentTab = tabs . getCurrentTab ( ) ;
297
-
298
297
if ( this . currentTab && this . currentTab . name === 'Shortcuts' ) {
299
298
const shortcuts = this . shadowRoot . querySelector (
300
299
'temba-shortcuts'
@@ -441,9 +440,9 @@ export class Compose extends FormElement {
441
440
442
441
if ( line . startsWith ( '/' ) ) {
443
442
// switch to the shortcuts tab
444
- const tabs = this . shadowRoot . querySelector ( 'temba-tabs ') as TabPane ;
445
- tabs . focusTab ( 'Shortcuts' ) ;
446
-
443
+ if ( this . currentTab . name !== 'Shortcuts ') {
444
+ this . getTabs ( ) . focusTab ( 'Shortcuts' ) ;
445
+ }
447
446
const shortcuts = this . shadowRoot . querySelector (
448
447
'temba-shortcuts'
449
448
) as ShortcutList ;
@@ -489,19 +488,11 @@ export class Compose extends FormElement {
489
488
tabs . index = num - 1 ;
490
489
}
491
490
492
- // if they type / as the first character in a line, switch to the shortcut
493
- if ( evt . key === '/' && this . currentTab . name !== 'Shortcuts' ) {
494
- const line = this . getCurrentLine ( ) ;
495
- const text = line . text . trim ( ) ;
496
- if ( text . trim ( ) . length === 1 ) {
497
- evt . preventDefault ( ) ;
498
- tabs . index = tabs . tabs . findIndex ( ( tab ) => tab . name === 'Shortcuts' ) ;
499
- }
500
- } else if ( evt . key === 'Backspace' ) {
491
+ if ( evt . key === 'Backspace' ) {
501
492
const line = this . getCurrentLine ( ) ;
502
493
const text = line . text ;
503
494
if ( text === '/' ) {
504
- tabs . index = tabs . tabs . findIndex ( ( tab ) => tab . name === 'Reply' ) ;
495
+ tabs . focusTab ( 'Reply' ) ;
505
496
}
506
497
}
507
498
@@ -540,7 +531,7 @@ export class Compose extends FormElement {
540
531
}
541
532
542
533
public resetTabs ( ) {
543
- ( this . shadowRoot . querySelector ( 'temba-tabs' ) as TabPane ) . index = 0 ;
534
+ this . getTabs ( ) . focusTab ( 'Reply' ) ;
544
535
}
545
536
546
537
public getTabs ( ) : TabPane {
@@ -637,7 +628,6 @@ export class Compose extends FormElement {
637
628
< temba-tabs
638
629
embedded
639
630
focusedname
640
- index ="0 "
641
631
@temba-context-changed =${ this . handleTabChanged }
642
632
refresh ="${ ( this . currentAttachments || [ ] ) . length } |${ this . index } |${ this
643
633
. currentQuickReplies . length } |${ showOptins } |${ this
0 commit comments