@@ -25,11 +25,11 @@ function FolderPopup(
2525 let left : number ;
2626
2727 if ( topLevel ) {
28- // show top level folder popup bellow its parent
28+ // Show top level folder popup bellow its parent
2929 top = parentRect . bottom ;
3030 left = parentRect . left ;
3131 } else {
32- // show nested folder popup beside its parent
32+ // Show nested folder popup beside its parent
3333 top = parentRect . top ;
3434 left = parentRect . right ;
3535 }
@@ -49,14 +49,15 @@ function FolderPopup(
4949 // TODO: Although popup position somewhat works it's still buggy in many
5050 // scenarios especially in folders with scrollbars
5151
52- // should be called directly after mounting component to the DOM
52+ // Only after the component is mounted in the DOM do we have element size
53+ // information so final position adjustment is split into a separate step
5354 root . adjustPosition = ( ) => {
5455 const viewportWidth = document . documentElement . clientWidth ;
5556 const width = root . offsetWidth ;
5657
5758 if ( left + width > viewportWidth ) {
58- // show top level aligned to the right edge of the viewport
59- // show nested show to the left of its parent
59+ // Show top level aligned to the right edge of the viewport
60+ // Show nested show to the left of its parent
6061 root . style . left = topLevel
6162 ? viewportWidth - width + 'px'
6263 : parentRect . left - width + 'px' ;
@@ -106,7 +107,7 @@ export function Folder(item: FolderProps): FolderComponent {
106107 if ( ! popup ) {
107108 const parent = root . parentNode as Element ;
108109
109- // immediately close any folder popups on the parent level
110+ // Immediately close any folder popups on the parent level
110111 parent
111112 . querySelectorAll < FolderComponent > ( '.f' )
112113 . forEach ( ( folder ) => folder . closePopup ( ) ) ;
0 commit comments