AJAX scrollTop() fails in EB modal with custom scrolling rules

Created on 17 January 2025, 5 days ago

Problem/Motivation

We have a case where we use Entity Browser modal dialog with a bit of custom CSS for scrolling which makes the view itself scrollable and not the whole EB modal dialog content. We do this so upper tabs are always visible in modal dialog.

With this customizations when user clicks on view pager links next JS errors happens:

This happens because code will never enter while loop (because view scrollTop() is already not null) and scrollTarget element will point to DOM element and not jQuery object - then scrollTarget.get(0) will fail.

Steps to reproduce

Add next CSS code which will change scroll behavior of EB modal dialog and make EB view scrollable and not modal content:

form.entity-browser-form {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

form.entity-browser-form .view,
form.entity-browser-form #ief-dropzone-upload {
  flex: 1 1 auto;
  overflow-x: hidden;
}

Then click on the view pager link in modal dialog and you will see exception in browser console.

Tested this with Drupal 10.4.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

10.4 ✨

Component

ajax system

Created by

πŸ‡·πŸ‡ΈSerbia pivica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024