Skip to content

Commit

Permalink
make scroll to element more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
ol0lll committed Apr 18, 2024
1 parent 1e916c8 commit b8ecb2b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js/paragraphs-features.scroll-to-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
*/
Drupal.AjaxCommands.prototype.scrollToElement = function (ajax, response, status) {
var resizeObserver = new ResizeObserver(function () {
document
.querySelector('[data-drupal-selector=' + response.drupalElementSelector + ']')
.scrollIntoView({block: 'center'});
const elem = document.querySelector('[data-drupal-selector=' + response.drupalElementSelector + ']');
elem?.scrollIntoView({block: 'center'});

Check failure on line 23 in js/paragraphs-features.scroll-to-element.js

View workflow job for this annotation

GitHub Actions / eslint

[eslint] js/paragraphs-features.scroll-to-element.js#L23

Parsing error: Unexpected token .
Raw output
{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token .","line":23,"column":12}
});

var parent = document.querySelector('[data-drupal-selector=' + response.drupalParentSelector + ']');
Expand Down

0 comments on commit b8ecb2b

Please sign in to comment.