accessify-widget 0.2.21 → 0.2.22

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.
@@ -1,4 +1,4 @@
1
- import { d, i } from "./index-DlEXo7aY.js";
1
+ import { d, i } from "./index-B9BgMU66.js";
2
2
  export {
3
3
  d as destroy,
4
4
  i as init
@@ -6351,14 +6351,14 @@ function FeatureGrid($$anchor, $$props) {
6351
6351
  const FEATURE_LOADERS = {
6352
6352
  contrast: () => import("./contrast-CqsICAkU.js"),
6353
6353
  "text-size": () => import("./text-size-C6OFhCGi.js"),
6354
- "keyboard-nav": () => import("./keyboard-nav-CZma_qRC.js"),
6354
+ "keyboard-nav": () => import("./keyboard-nav-cvuhPLSY.js"),
6355
6355
  "link-highlight": () => import("./link-highlight-DBGm067Y.js"),
6356
6356
  "reading-guide": () => import("./reading-guide-VT8NciIL.js"),
6357
6357
  "reading-mask": () => import("./reading-mask-BABChuCz.js"),
6358
6358
  "animation-stop": () => import("./animation-stop-C0MwseK0.js"),
6359
6359
  "hide-images": () => import("./hide-images-B_LeCBcd.js"),
6360
6360
  "big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
6361
- "page-structure": () => import("./page-structure-DTIVV243.js"),
6361
+ "page-structure": () => import("./page-structure-XImoLRLq.js"),
6362
6362
  tts: () => import("./tts-CjszLRnb.js"),
6363
6363
  "text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
6364
6364
  "alt-text": () => Promise.resolve().then(() => altText)
@@ -7828,6 +7828,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
7828
7828
  const processedImages = /* @__PURE__ */ new Map();
7829
7829
  let describeClickHandler = null;
7830
7830
  let describeEscHandler = null;
7831
+ const describeButtons = /* @__PURE__ */ new Map();
7831
7832
  function lang() {
7832
7833
  return getCurrentWidgetLang() || initialLang;
7833
7834
  }
@@ -7867,10 +7868,42 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
7867
7868
  content: none;
7868
7869
  }
7869
7870
 
7870
- img[data-a11y-describable="true"] {
7871
+ img[data-a11y-describable="true"]:not([data-a11y-is-link="true"]) {
7871
7872
  cursor: help !important;
7872
7873
  }
7873
7874
 
7875
+ .accessify-describe-btn {
7876
+ position: absolute;
7877
+ top: 6px;
7878
+ right: 6px;
7879
+ z-index: 10;
7880
+ width: 26px;
7881
+ height: 26px;
7882
+ padding: 0;
7883
+ border: none;
7884
+ border-radius: 50%;
7885
+ background: rgba(26, 26, 46, 0.85);
7886
+ color: #e0e0e0;
7887
+ font-family: system-ui, -apple-system, sans-serif;
7888
+ font-size: 14px;
7889
+ font-weight: 700;
7890
+ line-height: 26px;
7891
+ text-align: center;
7892
+ cursor: help;
7893
+ opacity: 0;
7894
+ transition: opacity 0.15s ease;
7895
+ backdrop-filter: blur(4px);
7896
+ box-shadow: 0 2px 8px rgba(0,0,0,0.3);
7897
+ }
7898
+ img[data-a11y-is-link="true"]:hover ~ .accessify-describe-btn,
7899
+ .accessify-describe-btn:hover {
7900
+ opacity: 1;
7901
+ }
7902
+ .accessify-describe-btn:hover {
7903
+ background: rgba(26, 26, 46, 0.95);
7904
+ color: #fff;
7905
+ }
7906
+
7874
7907
  .accessify-describe-tooltip {
7875
7908
  position: fixed;
7876
7909
  z-index: 2147483647;
@@ -8054,20 +8087,51 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8054
8087
  );
8055
8088
  }
8056
8089
  }
8057
- function enableClickToDescribe() {
8058
- document.querySelectorAll("img").forEach((img) => {
8059
- if (img.closest("#accessify-root") || img.closest("accessify-widget")) return;
8060
- if (img.complete && img.naturalWidth > 0 && (img.naturalWidth < 20 || img.naturalHeight < 20)) return;
8061
- img.dataset.a11yDescribable = "true";
8090
+ function isLinkedImage(img) {
8091
+ return !!img.closest("a[href]");
8092
+ }
8093
+ function addDescribeButton(img) {
8094
+ if (describeButtons.has(img)) return;
8095
+ const parent = img.parentElement;
8096
+ if (!parent) return;
8097
+ const pos = getComputedStyle(parent).position;
8098
+ if (pos === "static") parent.style.position = "relative";
8099
+ const btn = document.createElement("button");
8100
+ btn.className = "accessify-describe-btn";
8101
+ btn.textContent = "i";
8102
+ btn.setAttribute("aria-label", isDE() ? "Bildbeschreibung anzeigen" : "Show image description");
8103
+ btn.addEventListener("click", (e) => {
8104
+ e.preventDefault();
8105
+ e.stopPropagation();
8106
+ handleImageClick(img);
8062
8107
  });
8108
+ img.insertAdjacentElement("afterend", btn);
8109
+ describeButtons.set(img, btn);
8110
+ }
8111
+ function removeDescribeButtons() {
8112
+ describeButtons.forEach((btn) => btn.remove());
8113
+ describeButtons.clear();
8114
+ }
8115
+ function markImageDescribable(img) {
8116
+ if (img.closest("#accessify-root") || img.closest("accessify-widget")) return;
8117
+ if (img.complete && img.naturalWidth > 0 && (img.naturalWidth < 20 || img.naturalHeight < 20)) return;
8118
+ img.dataset.a11yDescribable = "true";
8119
+ if (isLinkedImage(img)) {
8120
+ img.dataset.a11yIsLink = "true";
8121
+ addDescribeButton(img);
8122
+ }
8123
+ }
8124
+ function enableClickToDescribe() {
8125
+ document.querySelectorAll("img").forEach(markImageDescribable);
8063
8126
  describeClickHandler = (e) => {
8127
+ if (e.target.closest(".accessify-describe-tooltip")) return;
8128
+ if (e.target.closest(".accessify-describe-btn")) return;
8064
8129
  const img = e.target.closest("img[data-a11y-describable]");
8065
8130
  if (!img) {
8066
- if (tooltipEl && !e.target.closest(".accessify-describe-tooltip")) {
8067
- hideDescribeTooltip();
8068
- }
8131
+ if (tooltipEl) hideDescribeTooltip();
8069
8132
  return;
8070
8133
  }
8134
+ if (isLinkedImage(img)) return;
8071
8135
  e.preventDefault();
8072
8136
  e.stopPropagation();
8073
8137
  handleImageClick(img);
@@ -8088,8 +8152,10 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8088
8152
  describeEscHandler = null;
8089
8153
  }
8090
8154
  hideDescribeTooltip();
8155
+ removeDescribeButtons();
8091
8156
  document.querySelectorAll("img[data-a11y-describable]").forEach((img) => {
8092
8157
  delete img.dataset.a11yDescribable;
8158
+ delete img.dataset.a11yIsLink;
8093
8159
  });
8094
8160
  }
8095
8161
  function isGenericAlt(alt) {
@@ -8281,7 +8347,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8281
8347
  function addIfValid() {
8282
8348
  if (!enabled || missingAltImages.includes(img)) return;
8283
8349
  if (img.naturalWidth < 20 || img.naturalHeight < 20) return;
8284
- img.dataset.a11yDescribable = "true";
8350
+ markImageDescribable(img);
8285
8351
  if (needsAltText(img)) {
8286
8352
  img.classList.add(HIGHLIGHT_CLASS);
8287
8353
  missingAltImages.push(img);
@@ -8564,4 +8630,4 @@ export {
8564
8630
  init as i,
8565
8631
  t
8566
8632
  };
8567
- //# sourceMappingURL=index-DlEXo7aY.js.map
8633
+ //# sourceMappingURL=index-B9BgMU66.js.map