diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-03 00:16:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-03 00:16:54 +0300 |
commit | a1ee5ac49b801535223f7498762f0c0820165a1a (patch) | |
tree | 8bfde6b9f8ac7872aa368a2f8d6c657583ec809d /app/assets/javascripts/settings_panels.js | |
parent | 05cde74f482201ed19d89c3c01ebf9b5d26cd4fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/settings_panels.js')
-rw-r--r-- | app/assets/javascripts/settings_panels.js | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/app/assets/javascripts/settings_panels.js b/app/assets/javascripts/settings_panels.js index 2c6da5669ef..fe5b21713a2 100644 --- a/app/assets/javascripts/settings_panels.js +++ b/app/assets/javascripts/settings_panels.js @@ -18,8 +18,6 @@ export function expandSection(sectionArg) { const $section = $(sectionArg); $section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse')); - // eslint-disable-next-line @gitlab/no-global-event-off - $section.find('.settings-content').off('scroll.expandSection').scrollTop(0); $section.addClass('expanded'); if (!$section.hasClass('no-animate')) { $section @@ -32,7 +30,6 @@ export function closeSection(sectionArg) { const $section = $(sectionArg); $section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Expand')); - $section.find('.settings-content').on('scroll.expandSection', () => expandSection($section)); $section.removeClass('expanded'); if (!$section.hasClass('no-animate')) { $section @@ -55,18 +52,16 @@ export default function initSettingsPanels() { const $section = $(elm); $section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section)); - if (!isExpanded($section)) { - $section.find('.settings-content').on('scroll.expandSection', () => { - $section.removeClass('no-animate'); + if (window.location.hash) { + const $target = $(window.location.hash); + if ( + $target.length && + !isExpanded($section) && + ($section.is($target) || $section.find($target).length) + ) { + $section.addClass('no-animate'); expandSection($section); - }); + } } }); - - if (window.location.hash) { - const $target = $(window.location.hash); - if ($target.length && $target.hasClass('settings')) { - expandSection($target); - } - } } |