File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
packages/uui-base/lib/mixins Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,26 @@ export const SelectableMixin = <T extends Constructor<LitElement>>(
115115
116116 if ( isSelectable === false ) return ;
117117
118- if ( e . composedPath ( ) . indexOf ( this . #selectableTarget) !== - 1 ) {
118+ const composePath = e . composedPath ( ) ;
119+
120+ if ( this . #selectableTarget === this ) {
121+ // the selectableTarget is not specified which means we need to be selective about what we accept events from.
122+ const isActionTag = composePath . some ( el => {
123+ const elementTagName = ( el as HTMLElement ) . tagName ;
124+ return (
125+ elementTagName === 'A' ||
126+ elementTagName === 'BUTTON' ||
127+ elementTagName === 'INPUT' ||
128+ elementTagName === 'TEXTAREA' ||
129+ elementTagName === 'SELECT'
130+ ) ;
131+ } ) ;
132+
133+ // never select when clicking on a link or button
134+ if ( isActionTag ) return ;
135+ }
136+
137+ if ( composePath . indexOf ( this . #selectableTarget) !== - 1 ) {
119138 if ( e . type === 'keydown' ) {
120139 e . preventDefault ( ) ; // Do not want the space key to trigger a page scroll.
121140 }
You can’t perform that action at this time.
0 commit comments