rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.61k stars 271 forks source link

Fix #966: Search click handler on spans #984

Open aalshakhshir1 opened 7 months ago

aalshakhshir1 commented 7 months ago

Fixes an issue (https://github.com/rapi-doc/RapiDoc/issues/966) with search where clicking on endpoint path/method is not scrolling due to event handler checking on event.target.contentId attribute. open to ideas/thoughts for a better fix

if (!navEl.dataset.contentId) {
  return;
}

This fix makes sure when clicking on any child element to pass the proper data-content-id within the event , not only the wrapper div

element: https://github.com/rapi-doc/RapiDoc/blob/18afdce428b1bc6838d52c9f391a982817271da4/src/templates/advance-search-template.js#L48

Event handler condition

https://github.com/rapi-doc/RapiDoc/blob/18afdce428b1bc6838d52c9f391a982817271da4/src/rapidoc.js#L952

Video:

https://github.com/rapi-doc/RapiDoc/assets/139879471/9e49658c-6632-4aa5-ace7-4cae272fcee6

Aalshakhshir commented 6 months ago

Hello @mrin9

Any updates on this one please