* Called by * - onClick of Navigation Bar * - onClick of Advanced Search items * * Functionality: * 1. First deactivate IntersectionObserver * 2. Scroll to the element * 3. Activate IntersectionObserver (after little delay) *
(event, scrollNavItemToView = true)
| 964 | * |
| 965 | */ |
| 966 | async scrollToEventTarget(event, scrollNavItemToView = true) { |
| 967 | if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) { |
| 968 | return; |
| 969 | } |
| 970 | const navEl = event.target; |
| 971 | if (!navEl.dataset.contentId) { |
| 972 | return; |
| 973 | } |
| 974 | this.isIntersectionObserverActive = false; |
| 975 | if (this.renderStyle === 'focused') { |
| 976 | const requestEl = this.shadowRoot.querySelector('api-request'); |
| 977 | if (requestEl) { |
| 978 | requestEl.beforeNavigationFocusedMode(); |
| 979 | } |
| 980 | } |
| 981 | this.scrollToPath(navEl.dataset.contentId, true, scrollNavItemToView); |
| 982 | setTimeout(() => { |
| 983 | this.isIntersectionObserverActive = true; |
| 984 | }, 300); |
| 985 | } |
| 986 | |
| 987 | // Public Method (scrolls to a given path and highlights the left-nav selection) |
| 988 | async scrollToPath(elementId, expandPath = true, scrollNavItemToView = true) { |
no test coverage detected