Skip to content

Commit

Permalink
Backport PR #15318: Fix scrolling when dragging files in the file bro…
Browse files Browse the repository at this point in the history
…wser (#15370)

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and krassowski committed Nov 8, 2023
1 parent c0e8646 commit e1b5d28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/filebrowser/src/listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,8 @@ export namespace DirListing {
const node = document.createElement('div');
const header = document.createElement('div');
const content = document.createElement('ul');
// Allow the node to scroll while dragging items.
content.setAttribute('data-lm-dragscroll', 'true');
content.className = CONTENT_CLASS;
header.className = HEADER_CLASS;
node.appendChild(header);
Expand Down
10 changes: 10 additions & 0 deletions packages/filebrowser/test/listing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ describe('filebrowser/listing', () => {
});
});

describe('#defaultRenderer', () => {
it('should enable scrolling when dragging items', () => {
const options = createOptionsForConstructor();
const dirListing = new DirListing(options);
expect(
dirListing.node.querySelector('[data-lm-dragscroll]')
).toBeDefined();
});
});

describe('#rename', () => {
it('backspace during rename does not trigger goUp method', async () => {
dirListing.selectNext();
Expand Down

0 comments on commit e1b5d28

Please sign in to comment.