@tangle-network/ui 11.28.0 → 11.28.1

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
@@ -1,5 +1,11 @@
1
1
  # @tangle-network/ui
2
2
 
3
+ ## 11.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 084cd75: A Markdown image without alt text now gives its full-size link the accessible name "Open image full size".
8
+
3
9
  ## 11.28.0
4
10
 
5
11
  ### Minor Changes
@@ -86,6 +86,7 @@ function MarkdownImage({ node: _node, src, alt, className, ...props }) {
86
86
  href: url,
87
87
  target: "_blank",
88
88
  rel: "noopener noreferrer",
89
+ "aria-label": alt ? void 0 : "Open image full size",
89
90
  className: "inline-block max-w-full",
90
91
  children: image
91
92
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/ui",
3
- "version": "11.28.0",
3
+ "version": "11.28.1",
4
4
  "description": "Generic React UI components for Tangle products — primitives, chat, run, files, editor, markdown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -114,6 +114,12 @@ describe("Markdown", () => {
114
114
  expect(ad.closest("a")).toHaveAttribute("target", "_blank");
115
115
  expect(ad.closest("a")).toHaveAttribute("rel", "noopener noreferrer");
116
116
 
117
+ render(<Markdown>{"![](https://example.com/decorative.png)"}</Markdown>);
118
+ expect(screen.getByRole("link", { name: "Open image full size" })).toHaveAttribute(
119
+ "href",
120
+ "https://example.com/decorative.png",
121
+ );
122
+
117
123
  const badge = screen.getByRole("img", { name: "Badge" });
118
124
  expect(badge.closest("a")).toHaveAttribute("href", "https://example.com/docs");
119
125
  expect(badge.closest("a")?.parentElement?.closest("a")).toBeNull();
@@ -113,7 +113,14 @@ function MarkdownImage({ node: _node, src, alt, className, ...props }: Component
113
113
  );
114
114
  if (insideLink) return image;
115
115
  return (
116
- <a href={url} target="_blank" rel="noopener noreferrer" className="inline-block max-w-full">
116
+ <a
117
+ href={url}
118
+ target="_blank"
119
+ rel="noopener noreferrer"
120
+ // An image without alt text would otherwise leave the link unnamed.
121
+ aria-label={alt ? undefined : "Open image full size"}
122
+ className="inline-block max-w-full"
123
+ >
117
124
  {image}
118
125
  </a>
119
126
  );