@examplary/ui 1.49.0 → 1.50.0

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.
@@ -4,7 +4,6 @@ export declare class ContentReferenceElement extends HTMLElement {
4
4
  disconnectedCallback(): void;
5
5
  private timeout;
6
6
  private handleClick;
7
- private handleKeyDown;
8
7
  private handleEnter;
9
8
  private handleLeave;
10
9
  private restore;
@@ -21,7 +21,16 @@ var ContentReferenceElement = /** @class */ (function (_super) {
21
21
  _this.targetEl = null;
22
22
  _this.timeout = null;
23
23
  _this.handleClick = function () {
24
+ var _a, _b;
24
25
  _this.handleEnter();
26
+ // Scroll new highlight into view
27
+ var highlight = (_a = _this.targetEl) === null || _a === void 0 ? void 0 : _a.querySelector("mark.content-reference-highlight");
28
+ if (highlight) {
29
+ (_b = highlight.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(highlight, {
30
+ behavior: "smooth",
31
+ block: "center",
32
+ });
33
+ }
25
34
  if (_this.timeout)
26
35
  clearTimeout(_this.timeout);
27
36
  _this.timeout = setTimeout(function () {
@@ -29,15 +38,7 @@ var ContentReferenceElement = /** @class */ (function (_super) {
29
38
  _this.restore();
30
39
  }, 2000);
31
40
  };
32
- _this.handleKeyDown = function (event) {
33
- if (event.key !== "Enter" && event.key !== " ")
34
- return;
35
- event.preventDefault();
36
- _this.handleClick();
37
- };
38
41
  _this.handleEnter = function () {
39
- if (_this.targetEl)
40
- return;
41
42
  var parent = _this.closest("[data-content-reference-target]");
42
43
  var targetId = parent === null || parent === void 0 ? void 0 : parent.dataset.contentReferenceTarget;
43
44
  if (!targetId)
@@ -73,7 +74,6 @@ var ContentReferenceElement = /** @class */ (function (_super) {
73
74
  this.addEventListener("mouseleave", this.handleLeave);
74
75
  this.addEventListener("click", this.handleClick);
75
76
  this.addEventListener("touchstart", this.handleClick);
76
- this.addEventListener("keydown", this.handleKeyDown);
77
77
  this.addEventListener("focus", this.handleEnter);
78
78
  this.addEventListener("blur", this.handleLeave);
79
79
  };
@@ -82,7 +82,6 @@ var ContentReferenceElement = /** @class */ (function (_super) {
82
82
  this.removeEventListener("mouseleave", this.handleLeave);
83
83
  this.removeEventListener("click", this.handleClick);
84
84
  this.removeEventListener("touchstart", this.handleClick);
85
- this.removeEventListener("keydown", this.handleKeyDown);
86
85
  this.removeEventListener("focus", this.handleEnter);
87
86
  this.removeEventListener("blur", this.handleLeave);
88
87
  this.restore();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@examplary/ui",
3
3
  "description": "UI components for the Examplary testing platform.",
4
4
  "packageManager": "yarn@4.5.3",
5
- "version": "1.49.0",
5
+ "version": "1.50.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "files": [