@salesforcedevs/dx-components 1.40.5-final-alpha → 1.40.5-final-alpha2

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.40.5-final-alpha",
3
+ "version": "1.40.5-final-alpha2",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -16,6 +16,7 @@
16
16
  display: flex;
17
17
  align-items: center;
18
18
  min-width: 0;
19
+ position: relative;
19
20
  }
20
21
 
21
22
  .tree-item-row dx-tree-tile {
@@ -29,6 +30,19 @@
29
30
  overflow: visible;
30
31
  }
31
32
 
33
+ /* Keyboard focus on the link. The tile sets data-focus-visible only then,
34
+ so a click does not ring. The next Tab clears it and focuses the picker. */
35
+ .tree-item-row:has(dx-tree-tile[data-focus-visible])::after {
36
+ content: "";
37
+ position: absolute;
38
+ z-index: 1;
39
+ inset: 0 var(--dx-g-spacing-lg) 0
40
+ var(--dx-g-global-header-padding-horizontal);
41
+ border-radius: var(--dx-g-spacing-2xs);
42
+ outline: var(--dx-g-spacing-2xs) solid var(--dx-g-blue-vibrant-40);
43
+ pointer-events: none;
44
+ }
45
+
32
46
  .tree-item-row-selected {
33
47
  background: var(--dx-g-cloud-blue-vibrant-95);
34
48
  box-shadow: inset var(--dx-g-spacing-xs) 0 0 0 var(--dx-g-blue-vibrant-40);
@@ -70,6 +70,15 @@
70
70
  padding-right: var(--dx-g-spacing-xs);
71
71
  }
72
72
 
73
+ /* Undo the shared focus inset. The row draws the ring around link and picker. */
74
+ .sidebar-item.tile-with-version-picker:focus-visible {
75
+ margin: 0;
76
+ padding-right: var(--dx-g-spacing-xs);
77
+ padding-left: var(--dx-g-global-header-padding-horizontal);
78
+ border-radius: 0;
79
+ outline: none;
80
+ }
81
+
73
82
  .tile-with-children .tile-label {
74
83
  order: 2;
75
84
  }
@@ -1,5 +1,12 @@
1
1
  <template>
2
- <a href={href} class={tileClass} target={target} aria-label={linkAriaLabel}>
2
+ <a
3
+ href={href}
4
+ class={tileClass}
5
+ target={target}
6
+ aria-label={linkAriaLabel}
7
+ onfocus={onLinkFocus}
8
+ onblur={onLinkBlur}
9
+ >
3
10
  <div class="flex indentation" role="heading" aria-level={tileAriaLevel}>
4
11
  <div class="flex tile-expand-icon tile-icon" if:true={showArrow}>
5
12
  <dx-icon
@@ -119,4 +119,18 @@ export default class TreeTile extends LightningElement {
119
119
  event.stopPropagation();
120
120
  this.dispatchEvent(new CustomEvent("iconclick"));
121
121
  }
122
+
123
+ /* :focus-visible does not cross this shadow root, so the row reads it here. */
124
+ private onLinkFocus(event: FocusEvent) {
125
+ const link = event.currentTarget as HTMLElement;
126
+ if (this.hasVersionPicker && link.matches(":focus-visible")) {
127
+ this.setAttribute("data-focus-visible", "");
128
+ return;
129
+ }
130
+ this.removeAttribute("data-focus-visible");
131
+ }
132
+
133
+ private onLinkBlur() {
134
+ this.removeAttribute("data-focus-visible");
135
+ }
122
136
  }
@@ -294,13 +294,13 @@ export function toCanonicalHref(
294
294
  }
295
295
 
296
296
  for (const version of versions) {
297
- if (version.id === versions[0].id) {
298
- continue;
299
- }
300
- const delta = getVersionPathDelta(
301
- latestPath,
302
- normalizePath(version.link?.href)
303
- );
297
+ // The latest is also served under `/<latestId>/`, so that form is
298
+ // stripped too.
299
+ const versionedPath =
300
+ version.id === versions[0].id
301
+ ? insertVersionBeforeSlug(latestPath, version.id)
302
+ : normalizePath(version.link?.href);
303
+ const delta = getVersionPathDelta(latestPath, versionedPath);
304
304
  const stripped = delta && stripVersionPathDelta(hrefPath, delta);
305
305
  if (stripped) {
306
306
  return stripped;
@@ -315,10 +315,19 @@ function hrefMatchesVersion(
315
315
  version: TopicVersionOption,
316
316
  versions: TopicVersionOption[]
317
317
  ): boolean {
318
- return hrefMatchesCurrentPage(applyVersionToHref(href, version, versions));
318
+ if (hrefMatchesCurrentPage(applyVersionToHref(href, version, versions))) {
319
+ return true;
320
+ }
321
+ // The server serves the latest under its canonical URL and also under
322
+ // `/<latestId>/`, so the versioned form must select the latest too.
323
+ return (
324
+ !!href &&
325
+ version.id === versions[0]?.id &&
326
+ hrefMatchesCurrentPage(insertVersionBeforeSlug(href, version.id))
327
+ );
319
328
  }
320
329
 
321
- function collectSubtreeCanonicalHrefs(
330
+ export function collectSubtreeCanonicalHrefs(
322
331
  node: VersionedNode,
323
332
  includeSelf = true
324
333
  ): string[] {