Move ScrollTopCommand views Ajax command to the Drupal Core

Created on 28 July 2022, over 2 years ago
Updated 4 March 2023, over 1 year ago

Problem/Motivation

Drupal Views module has a very useful AJAX command ScrollTopCommand that allows to do a scroll in AJAX callbacks.

This function seems to be already used in many contrib modules: http://grep.xnddx.ru/search?text=ScrollTopCommand

And it looks pretty universal, without any direct dependency on Views.

So maybe move it from Views module to Drupal Core AJAX API? And we can keep a "Proxy" function in the Views Libraries to not break the old code, that already including it from the Views module.

Proposed resolution

Move scrollTop command from core/modules/views/js/ajax_view.js to core/misc/ajax.js with keeping the function as a proxy to call core's one (to backward compatibility).

Move core/modules/views/src/Ajax/ScrollTopCommand.php to core/lib/Drupal/Core/Ajax/ScrollTopCommand.php with keeping the function as a proxy to call core's one (for backward compatibility).

Remaining tasks

Review

User interface changes

None.

API changes

The function can be used as previously, but now it not requires the Views module, and can work from the Core directly.

Data model changes

None.

Release notes snippet

JS AJAX command scrollTop is moved from views/js/ajax_view.js to core/misc/ajax.js with keeping the function as a proxy on old place for backward compatibility.

Feature request
Status

Fixed

Version

10.1

Component
Ajax 

Last updated about 11 hours ago

Created by

🇦🇲Armenia murz Yerevan, Armenia

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024