@instructure/ui-link 11.7.4-snapshot-136 → 11.7.4-snapshot-144

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
@@ -3,7 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [11.7.4-snapshot-136](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-136) (2026-07-24)
6
+ ## [11.7.4-snapshot-144](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-144) (2026-07-24)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **many:** do not allow javascript: and data: hrefs ([4a0ac03](https://github.com/instructure/instructure-ui/commit/4a0ac038c6a4102646e04d27c1c3251f97367822))
7
12
 
8
13
 
9
14
  ### Features
@@ -28,7 +28,7 @@ import { View } from '@instructure/ui-view/v11_6';
28
28
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
29
29
  import { isActiveElement, findFocusable } from '@instructure/ui-dom-utils';
30
30
  import { getElementType, getInteraction, matchComponentTypes, passthroughProps, callRenderProp } from '@instructure/ui-react-utils';
31
- import { combineDataCid } from '@instructure/ui-utils';
31
+ import { combineDataCid, safeLinkProps } from '@instructure/ui-utils';
32
32
  import { logWarn as warn } from '@instructure/console';
33
33
  import { withStyle } from '@instructure/emotion';
34
34
  import generateStyle from './styles.js';
@@ -182,13 +182,23 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
182
182
  onClick,
183
183
  onMouseEnter,
184
184
  color,
185
- href,
185
+ href: rawHref,
186
186
  margin,
187
187
  renderIcon,
188
188
  iconPlacement,
189
189
  isWithinText,
190
190
  ...props
191
191
  } = this.props;
192
+ const {
193
+ href,
194
+ rel
195
+ } = safeLinkProps({
196
+ attr: 'href',
197
+ tag: typeof this.element === 'string' ? this.element : 'a',
198
+ href: rawHref,
199
+ target: props.target,
200
+ rel: props.rel
201
+ });
192
202
  const {
193
203
  interaction
194
204
  } = this;
@@ -202,6 +212,7 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
202
212
  display: this.display,
203
213
  margin: margin,
204
214
  href: href,
215
+ rel: rel,
205
216
  onMouseEnter: onMouseEnter,
206
217
  onClick: this.handleClick,
207
218
  onFocus: this.handleFocus,
@@ -28,7 +28,7 @@ import { View } from '@instructure/ui-view/latest';
28
28
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
29
29
  import { isActiveElement, findFocusable } from '@instructure/ui-dom-utils';
30
30
  import { getElementType, getInteraction, matchComponentTypes, passthroughProps } from '@instructure/ui-react-utils';
31
- import { combineDataCid } from '@instructure/ui-utils';
31
+ import { combineDataCid, safeLinkProps } from '@instructure/ui-utils';
32
32
  import { logWarn as warn } from '@instructure/console';
33
33
  import { renderIconWithProps } from '@instructure/ui-icons';
34
34
  import { withStyleNew } from '@instructure/emotion';
@@ -206,12 +206,22 @@ let Link = (_dec = withStyleNew(generateStyle), _dec(_class = class Link extends
206
206
  onClick,
207
207
  onMouseEnter,
208
208
  color,
209
- href,
209
+ href: rawHref,
210
210
  margin,
211
211
  renderIcon,
212
212
  iconPlacement,
213
213
  ...props
214
214
  } = this.props;
215
+ const {
216
+ href,
217
+ rel
218
+ } = safeLinkProps({
219
+ attr: 'href',
220
+ tag: typeof this.element === 'string' ? this.element : 'a',
221
+ href: rawHref,
222
+ target: props.target,
223
+ rel: props.rel
224
+ });
215
225
  const {
216
226
  interaction
217
227
  } = this;
@@ -225,6 +235,7 @@ let Link = (_dec = withStyleNew(generateStyle), _dec(_class = class Link extends
225
235
  display: this.display,
226
236
  margin: margin,
227
237
  href: href,
238
+ rel: rel,
228
239
  onMouseEnter: onMouseEnter,
229
240
  onClick: this.handleClick,
230
241
  onFocus: this.handleFocus,
@@ -16,6 +16,7 @@ var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchCompone
16
16
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
17
17
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
18
18
  var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
19
+ var _safeLinkProps = require("@instructure/ui-utils/lib/safeLinkProps.js");
19
20
  var _console = require("@instructure/console");
20
21
  var _emotion = require("@instructure/emotion");
21
22
  var _styles = _interopRequireDefault(require("./styles.js"));
@@ -193,13 +194,23 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _them
193
194
  onClick,
194
195
  onMouseEnter,
195
196
  color,
196
- href,
197
+ href: rawHref,
197
198
  margin,
198
199
  renderIcon,
199
200
  iconPlacement,
200
201
  isWithinText,
201
202
  ...props
202
203
  } = this.props;
204
+ const {
205
+ href,
206
+ rel
207
+ } = (0, _safeLinkProps.safeLinkProps)({
208
+ attr: 'href',
209
+ tag: typeof this.element === 'string' ? this.element : 'a',
210
+ href: rawHref,
211
+ target: props.target,
212
+ rel: props.rel
213
+ });
203
214
  const {
204
215
  interaction
205
216
  } = this;
@@ -213,6 +224,7 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _them
213
224
  display: this.display,
214
225
  margin: margin,
215
226
  href: href,
227
+ rel: rel,
216
228
  onMouseEnter: onMouseEnter,
217
229
  onClick: this.handleClick,
218
230
  onFocus: this.handleFocus,
@@ -15,6 +15,7 @@ var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js
15
15
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
16
16
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
17
17
  var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
18
+ var _safeLinkProps = require("@instructure/ui-utils/lib/safeLinkProps.js");
18
19
  var _console = require("@instructure/console");
19
20
  var _renderIconWithProps = require("@instructure/ui-icons/lib/IconPropsProvider/renderIconWithProps.js");
20
21
  var _emotion = require("@instructure/emotion");
@@ -216,12 +217,22 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyleNew)(_styles.default), _
216
217
  onClick,
217
218
  onMouseEnter,
218
219
  color,
219
- href,
220
+ href: rawHref,
220
221
  margin,
221
222
  renderIcon,
222
223
  iconPlacement,
223
224
  ...props
224
225
  } = this.props;
226
+ const {
227
+ href,
228
+ rel
229
+ } = (0, _safeLinkProps.safeLinkProps)({
230
+ attr: 'href',
231
+ tag: typeof this.element === 'string' ? this.element : 'a',
232
+ href: rawHref,
233
+ target: props.target,
234
+ rel: props.rel
235
+ });
225
236
  const {
226
237
  interaction
227
238
  } = this;
@@ -235,6 +246,7 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyleNew)(_styles.default), _
235
246
  display: this.display,
236
247
  margin: margin,
237
248
  href: href,
249
+ rel: rel,
238
250
  onMouseEnter: onMouseEnter,
239
251
  onClick: this.handleClick,
240
252
  onFocus: this.handleFocus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-link",
3
- "version": "11.7.4-snapshot-136",
3
+ "version": "11.7.4-snapshot-144",
4
4
  "description": "A component for creating links",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,25 +15,25 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.29.7",
18
- "@instructure/console": "11.7.4-snapshot-136",
19
- "@instructure/emotion": "11.7.4-snapshot-136",
20
- "@instructure/ui-a11y-utils": "11.7.4-snapshot-136",
21
- "@instructure/shared-types": "11.7.4-snapshot-136",
22
- "@instructure/ui-color-utils": "11.7.4-snapshot-136",
23
- "@instructure/ui-dom-utils": "11.7.4-snapshot-136",
24
- "@instructure/ui-icons": "11.7.4-snapshot-136",
25
- "@instructure/ui-react-utils": "11.7.4-snapshot-136",
26
- "@instructure/ui-utils": "11.7.4-snapshot-136",
27
- "@instructure/ui-themes": "11.7.4-snapshot-136",
28
- "@instructure/ui-view": "11.7.4-snapshot-136"
18
+ "@instructure/console": "11.7.4-snapshot-144",
19
+ "@instructure/shared-types": "11.7.4-snapshot-144",
20
+ "@instructure/ui-color-utils": "11.7.4-snapshot-144",
21
+ "@instructure/ui-dom-utils": "11.7.4-snapshot-144",
22
+ "@instructure/ui-a11y-utils": "11.7.4-snapshot-144",
23
+ "@instructure/ui-icons": "11.7.4-snapshot-144",
24
+ "@instructure/emotion": "11.7.4-snapshot-144",
25
+ "@instructure/ui-react-utils": "11.7.4-snapshot-144",
26
+ "@instructure/ui-themes": "11.7.4-snapshot-144",
27
+ "@instructure/ui-utils": "11.7.4-snapshot-144",
28
+ "@instructure/ui-view": "11.7.4-snapshot-144"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@testing-library/jest-dom": "^6.9.1",
32
32
  "@testing-library/react": "16.3.2",
33
33
  "@testing-library/user-event": "^14.6.1",
34
34
  "vitest": "^4.1.9",
35
- "@instructure/ui-axe-check": "11.7.4-snapshot-136",
36
- "@instructure/ui-babel-preset": "11.7.4-snapshot-136"
35
+ "@instructure/ui-axe-check": "11.7.4-snapshot-144",
36
+ "@instructure/ui-babel-preset": "11.7.4-snapshot-144"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "react": ">=18 <=19"
@@ -34,7 +34,7 @@ import {
34
34
  passthroughProps,
35
35
  callRenderProp
36
36
  } from '@instructure/ui-react-utils'
37
- import { combineDataCid } from '@instructure/ui-utils'
37
+ import { combineDataCid, safeLinkProps } from '@instructure/ui-utils'
38
38
  import { logWarn as warn } from '@instructure/console'
39
39
 
40
40
  import { withStyle } from '@instructure/emotion'
@@ -213,13 +213,20 @@ class Link extends Component<LinkProps, LinkState> {
213
213
  onClick,
214
214
  onMouseEnter,
215
215
  color,
216
- href,
216
+ href: rawHref,
217
217
  margin,
218
218
  renderIcon,
219
219
  iconPlacement,
220
220
  isWithinText,
221
221
  ...props
222
222
  } = this.props
223
+ const { href, rel } = safeLinkProps({
224
+ attr: 'href',
225
+ tag: typeof this.element === 'string' ? this.element : 'a',
226
+ href: rawHref,
227
+ target: (props as { target?: string }).target,
228
+ rel: (props as { rel?: string }).rel
229
+ })
223
230
 
224
231
  const { interaction } = this
225
232
 
@@ -240,6 +247,7 @@ class Link extends Component<LinkProps, LinkState> {
240
247
  display={this.display}
241
248
  margin={margin}
242
249
  href={href}
250
+ rel={rel}
243
251
  onMouseEnter={onMouseEnter}
244
252
  onClick={this.handleClick}
245
253
  onFocus={this.handleFocus}
@@ -33,7 +33,7 @@ import {
33
33
  matchComponentTypes,
34
34
  passthroughProps
35
35
  } from '@instructure/ui-react-utils'
36
- import { combineDataCid } from '@instructure/ui-utils'
36
+ import { combineDataCid, safeLinkProps } from '@instructure/ui-utils'
37
37
  import { logWarn as warn } from '@instructure/console'
38
38
  import { renderIconWithProps } from '@instructure/ui-icons'
39
39
 
@@ -235,12 +235,19 @@ class Link extends Component<LinkProps, LinkState> {
235
235
  onClick,
236
236
  onMouseEnter,
237
237
  color,
238
- href,
238
+ href: rawHref,
239
239
  margin,
240
240
  renderIcon,
241
241
  iconPlacement,
242
242
  ...props
243
243
  } = this.props
244
+ const { href, rel } = safeLinkProps({
245
+ attr: 'href',
246
+ tag: typeof this.element === 'string' ? this.element : 'a',
247
+ href: rawHref,
248
+ target: (props as { target?: string }).target,
249
+ rel: (props as { rel?: string }).rel
250
+ })
244
251
 
245
252
  const { interaction } = this
246
253
 
@@ -261,6 +268,7 @@ class Link extends Component<LinkProps, LinkState> {
261
268
  display={this.display}
262
269
  margin={margin}
263
270
  href={href}
271
+ rel={rel}
264
272
  onMouseEnter={onMouseEnter}
265
273
  onClick={this.handleClick}
266
274
  onFocus={this.handleFocus}