File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
packages/mgt-components/src/components/mgt-teams-channel-picker Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -716,17 +716,19 @@ export class MgtTeamsChannelPicker extends MgtTemplatedTaskComponent {
716
716
event . stopImmediatePropagation ( ) ;
717
717
const element = event . target as HTMLElement ;
718
718
if ( element ) {
719
- const expanded = element . getAttribute ( 'expanded' ) ;
720
-
721
- if ( expanded ) {
719
+ const isExpanded = element . hasAttribute ( 'expanded' ) ;
720
+ if ( isExpanded ) {
722
721
element . removeAttribute ( 'expanded' ) ;
723
722
} else {
724
723
element . setAttribute ( 'expanded' , 'true' ) ;
725
724
}
726
- element . removeAttribute ( 'selected' ) ;
727
- const hasId = element . getAttribute ( 'id' ) ;
725
+
726
+ // Only set selected attribute for channels (items with IDs)
727
+ const hasId = element . hasAttribute ( 'id' ) ;
728
728
if ( hasId ) {
729
729
element . setAttribute ( 'selected' , 'true' ) ;
730
+ } else {
731
+ element . removeAttribute ( 'selected' ) ;
730
732
}
731
733
}
732
734
} ;
You can’t perform that action at this time.
0 commit comments