Skip to content

Conversation

@krassowski
Copy link
Member

@krassowski krassowski commented Aug 6, 2024

References

Code changes

  • after initial load the fixed-width layout is used in favour of the flexbox which is now only used to load initial widths and for backward compatibility
  • the filename icon and label are now grouped together into a single node which allows to set a column size on the file name column
  • FileBrowser and DirListing widgets now accept optional state?: IStateDB option which allows the listing to restore the size of columns; this follows the pattern already used in the FileBrowserModel
  • DirListing.IRenderer gets a new optional updateItemSize?(...): void method which is a fast path to refresh the widths in the listing without updating other elements
  • The default implementation of DirListing.IRenderer.updateItemModified() will now check if there is any work to be done to avoid costly format() calls
  • All hidden columns are now detached from the DOM when hidden, which saves time on rendering (which happens often when resizing); previously checkboxes were detached but "Last Modified" and "File Size" were just hidden using CSS

User-facing changes

  • The file browser render and refreshes faster
  • Columns can be resized
    resize-demo

Backwards-incompatible changes

None

@krassowski krassowski added this to the 4.3.0 milestone Aug 6, 2024
@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@github-actions github-actions bot added pkg:filebrowser tag:CSS For general CSS related issues and pecadilloes Design System CSS labels Aug 6, 2024
This change:
- reduces visual diff
- allows more space for the name/modified/size columns when checkboxes
  are shown as there is less space taken up by the resize handle for
  a column which always presents a very narrow checkbox and thus does
  not really benefit from resizing
but all columns have sizes even they are not resizable.
@krassowski
Copy link
Member Author

Because I had to rework (=improve) the caret positioning, the caret is no longer inflating the height of the column headers. This does not change the height as seen when checkboxes are enabled (because the checkbox in the header is inflating the height too) but it reduces the height otherwise:

Before Now
image image

I personally don't mind having a little bit more space for files, but if there are strong opinions I am happy to reinstate the extra pixel or two - just let me know.

@krassowski krassowski force-pushed the resize-file-browser branch from 2ea1d74 to 7748235 Compare August 9, 2024 11:51
} else if (showFileCheckboxes && !checkboxWrapper) {
const checkboxWrapper = this.createCheckboxWrapperNode();
node.insertBefore(checkboxWrapper, iconContainer);
nameColumn.insertAdjacentElement('beforebegin', checkboxWrapper);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching to insertAdjacentElement is nice.

Copy link
Member

@afshin afshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @krassowski! I made one minor comment.

Co-authored-by: Afshin Taylor Darian <git@darian.link>
@krassowski krassowski force-pushed the resize-file-browser branch from 80f9eee to 8c2db7c Compare August 10, 2024 16:15
@krassowski krassowski merged commit da22583 into jupyterlab:main Aug 10, 2024
ImpSy pushed a commit to spotinst/jupyterlab that referenced this pull request Jan 7, 2025
* Implement resizing for file browser

* Fine tune pixels, expand docs

* Do not add a resize handle for checkboxes column

This change:
- reduces visual diff
- allows more space for the name/modified/size columns when checkboxes
  are shown as there is less space taken up by the resize handle for
  a column which always presents a very narrow checkbox and thus does
  not really benefit from resizing

* Fix column sorting

* Fix typing on sizing: `is_selected` is no resizable,

but all columns have sizes even they are not resizable.

* Add missing freeze filter for custom css snapshot test

* Update snapshots

* Remove prefix underscore from protected attribute

Co-authored-by: Afshin Taylor Darian <git@darian.link>

---------

Co-authored-by: Afshin Taylor Darian <git@darian.link>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2025
@krassowski krassowski deleted the resize-file-browser branch October 23, 2025 18:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The "Modified" header moves sort caret icon to next line if sidebar is narrow Resize columns of file browser

2 participants