MCPcopy
hub / github.com/rapi-doc/RapiDoc / scrollToEventTarget

Method scrollToEventTarget

src/rapidoc.js:966–985  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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) {

Callers 3

jsonSchemaNavTemplateFunction · 0.45

Calls 2

scrollToPathMethod · 0.95

Tested by

no test coverage detected