reflet-sdk 0.4.1 → 0.4.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to `reflet-sdk` will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.2] - 2026-09-22
9
+
10
+ ### Fixed
11
+
12
+ - Keys typed in the widget no longer trigger the host page's keyboard shortcuts — Space in the message types a space instead of playing or pausing the host's video
13
+ - Host shortcuts listening in the capture phase still run first; they should read `event.composedPath()[0]` rather than `event.target` to recognise the widget's text fields
14
+
8
15
  ## [0.4.1] - 2026-09-20
9
16
 
10
17
  ### Added
package/dist/feedback.js CHANGED
@@ -810,7 +810,7 @@ function collectPageContext(options) {
810
810
  }
811
811
  //#endregion
812
812
  //#region src/feedback/types.ts
813
- const SDK_VERSION = "0.4.1";
813
+ const SDK_VERSION = "0.4.2";
814
814
  const DEFAULT_WIDGET_LABELS = {
815
815
  annotateHint: "Draw on the screenshot to point at the problem.",
816
816
  attachElement: "Attach this element",
@@ -2621,14 +2621,23 @@ function FloatingWidget({ labels, position, state }) {
2621
2621
  useEffect(() => {
2622
2622
  if (!showPanel || state.step !== "compose") return;
2623
2623
  const onKeyDown = (event) => {
2624
- if (event.key === "Escape" && !event.defaultPrevented) {
2624
+ if (event instanceof KeyboardEvent && event.key === "Escape" && !event.defaultPrevented) {
2625
2625
  setMinimized(true);
2626
2626
  requestAnimationFrame(() => launcherRef.current?.focus());
2627
2627
  }
2628
2628
  };
2629
+ const widgetRoot = floating.rootRef.current?.getRootNode();
2629
2630
  document.addEventListener("keydown", onKeyDown);
2630
- return () => document.removeEventListener("keydown", onKeyDown);
2631
- }, [showPanel, state.step]);
2631
+ widgetRoot?.addEventListener("keydown", onKeyDown);
2632
+ return () => {
2633
+ document.removeEventListener("keydown", onKeyDown);
2634
+ widgetRoot?.removeEventListener("keydown", onKeyDown);
2635
+ };
2636
+ }, [
2637
+ floating.rootRef,
2638
+ showPanel,
2639
+ state.step
2640
+ ]);
2632
2641
  return /* @__PURE__ */ jsxs("div", {
2633
2642
  className: "root",
2634
2643
  "data-editing": state.isOpen && (state.step === "picking" || state.step === "annotate"),
@@ -3446,6 +3455,11 @@ ${PICKER_STYLES}
3446
3455
  //#endregion
3447
3456
  //#region src/feedback/ui/shadow-portal.tsx
3448
3457
  const DARK_QUERY = "(prefers-color-scheme: dark)";
3458
+ const KEY_EVENTS = [
3459
+ "keydown",
3460
+ "keyup",
3461
+ "keypress"
3462
+ ];
3449
3463
  function useResolvedTheme(theme) {
3450
3464
  const [systemDark, setSystemDark] = useState(false);
3451
3465
  useEffect(() => {
@@ -3471,6 +3485,7 @@ function ShadowPortal({ children, offset, primaryColor, theme }) {
3471
3485
  const host = document.createElement("div");
3472
3486
  host.setAttribute(WIDGET_MARKER, "");
3473
3487
  const root = host.attachShadow({ mode: "open" });
3488
+ for (const type of KEY_EVENTS) root.addEventListener(type, (event) => event.stopPropagation());
3474
3489
  const style = document.createElement("style");
3475
3490
  style.textContent = WIDGET_STYLES;
3476
3491
  root.append(style);
@@ -4099,7 +4114,7 @@ function useWidgetState(props) {
4099
4114
  setStep("compose");
4100
4115
  return submission.submit({
4101
4116
  context: {
4102
- ...activeScreenshot?.context ?? collectPageContext({ sdkVersion: "0.4.1" }),
4117
+ ...activeScreenshot?.context ?? collectPageContext({ sdkVersion: "0.4.2" }),
4103
4118
  consoleEvents: consoleRef.current?.events(),
4104
4119
  metadata: props.metadata,
4105
4120
  selections
@@ -4181,8 +4196,8 @@ function RefletFeedback(props) {
4181
4196
  else open();
4182
4197
  }
4183
4198
  };
4184
- document.addEventListener("keydown", onKeyDown);
4185
- return () => document.removeEventListener("keydown", onKeyDown);
4199
+ document.addEventListener("keydown", onKeyDown, true);
4200
+ return () => document.removeEventListener("keydown", onKeyDown, true);
4186
4201
  }, [
4187
4202
  close,
4188
4203
  enabled,