File tree Expand file tree Collapse file tree
app/components/primer/alpha/tree_view Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ export class TreeViewElement extends HTMLElement {
193193 // behavior for these element types is user- or browser-defined
194194 if ( ! ( node instanceof HTMLDivElement ) ) return
195195
196+ const path = this . getNodePath ( node )
196197 const nodeInfo = this . infoFromNode ( node , 'true' )
197198
198199 const checkSuccess = this . dispatchEvent (
@@ -205,17 +206,10 @@ export class TreeViewElement extends HTMLElement {
205206
206207 if ( ! checkSuccess ) return
207208
208- const currentlyChecked = this . getNodeCheckedValue ( node ) === 'true'
209-
210- if ( currentlyChecked ) {
209+ if ( this . getNodeCheckedValue ( node ) === 'true' ) {
211210 this . setNodeCheckedValue ( node , 'false' )
212211 } else {
213- // Uncheck all other nodes first
214- for ( const el of this . activeNodes ) {
215- this . uncheckAtPath ( this . getNodePath ( el ) )
216- }
217-
218- this . setNodeCheckedValue ( node , 'true' )
212+ this . checkOnlyAtPath ( path ) ;
219213 }
220214
221215 this . dispatchEvent (
You can’t perform that action at this time.
0 commit comments