@salesforcedevs/dx-components 1.32.0-alpha.4 → 1.32.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.32.0-alpha.4",
3
+ "version": "1.32.0-alpha.5",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,5 +44,5 @@
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
46
  },
47
- "gitHead": "48ef4e10a9004131b3c63b3817d0d62ed1a28b6b"
47
+ "gitHead": "e470c1e1ce20a2e45377e1527c65dbb231119f13"
48
48
  }
@@ -204,18 +204,23 @@ export default class Sidebar extends SidebarBase {
204
204
  const searchContent = this.template.querySelector(
205
205
  ".sidebar-content-search"
206
206
  ) as HTMLElement | null;
207
- const selectedResult = searchContent?.querySelector(
208
- `dx-sidebar-search-result:nth-child(${
209
- selectedSearchResultIndex + 1
210
- })`
211
- ) as HTMLElement | null;
207
+ const allResultItems = searchContent?.querySelectorAll(
208
+ "dx-sidebar-search-result"
209
+ );
210
+ const selectedResult =
211
+ (allResultItems?.[selectedSearchResultIndex] as HTMLElement) ||
212
+ null;
212
213
  if (!searchContent || !selectedResult) {
213
214
  return;
214
215
  }
215
216
 
216
- searchContent.scrollTop =
217
- selectedResult.offsetTop - searchContent.offsetTop;
218
- this.scrollToSelectedSearchResult = false;
217
+ window.requestAnimationFrame(() => {
218
+ selectedResult.scrollIntoView({
219
+ block: "start",
220
+ inline: "nearest"
221
+ });
222
+ this.scrollToSelectedSearchResult = false;
223
+ });
219
224
  }
220
225
 
221
226
  private assignValueToLabel(node: TreeNode): void {