diff options
Diffstat (limited to 'core/misc')
-rw-r--r-- | core/misc/ajax.js | 18 | ||||
-rw-r--r-- | core/misc/components/item-list.module.css | 19 | ||||
-rw-r--r-- | core/misc/tableresponsive.js | 13 |
3 files changed, 27 insertions, 23 deletions
diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 252e0db24d1e..a9ce2cf3fcd0 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -1860,23 +1860,7 @@ * Selector to use. */ scrollTop(ajax, response) { - const offset = $(response.selector).offset(); - // We can't guarantee that the scrollable object should be - // the body, as the element could be embedded in something - // more complex such as a modal popup. Recurse up the DOM - // and scroll the first element that has a non-zero top. - let scrollTarget = response.selector; - while ($(scrollTarget).scrollTop() === 0 && $(scrollTarget).parent()) { - scrollTarget = $(scrollTarget).parent(); - } - - // Only scroll upward. - if (offset.top - 10 < $(scrollTarget).scrollTop()) { - scrollTarget.get(0).scrollTo({ - top: offset.top - 10, - behavior: 'smooth', - }); - } + document.querySelector(response.selector)?.scrollIntoView(); }, }; diff --git a/core/misc/components/item-list.module.css b/core/misc/components/item-list.module.css new file mode 100644 index 000000000000..2d23ee5bd335 --- /dev/null +++ b/core/misc/components/item-list.module.css @@ -0,0 +1,19 @@ +/** + * @file + * Styles for item list. + */ + +.item-list__comma-list, +.item-list__comma-list li { + display: inline; +} +.item-list__comma-list { + margin: 0; + padding: 0; +} +.item-list__comma-list li::after { + content: ", "; +} +.item-list__comma-list li:last-child::after { + content: ""; +} diff --git a/core/misc/tableresponsive.js b/core/misc/tableresponsive.js index 39ad39bf72fe..e65c0b581c95 100644 --- a/core/misc/tableresponsive.js +++ b/core/misc/tableresponsive.js @@ -46,12 +46,10 @@ ); // Attach a resize handler to the window. - $(window) - .on( - 'resize.tableresponsive', - this.eventhandlerEvaluateColumnVisibility.bind(this), - ) - .trigger('resize.tableresponsive'); + $(window).on( + 'resize.tableresponsive', + this.eventhandlerEvaluateColumnVisibility.bind(this), + ); } /** @@ -69,6 +67,9 @@ TableResponsive.tables.push(new TableResponsive(table)); }, ); + if (TableResponsive.tables.length) { + $(window).trigger('resize.tableresponsive'); + } }, }; |