@instructure/ui-buttons 11.7.4-snapshot-135 → 11.7.4-snapshot-142

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,11 +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-135](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-135) (2026-07-24)
6
+ ## [11.7.4-snapshot-142](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-142) (2026-07-24)
7
7
 
8
8
 
9
9
  ### Bug Fixes
10
10
 
11
+ * **many:** do not allow javascript: and data: hrefs ([4a0ac03](https://github.com/instructure/instructure-ui/commit/4a0ac038c6a4102646e04d27c1c3251f97367822))
11
12
  * **ui-buttons:** fix ai-secondary button size diff ([d559a3f](https://github.com/instructure/instructure-ui/commit/d559a3f5444ac70ef4f037f8810336825fb5e795))
12
13
  * **ui-buttons:** fix buttons disabled style and color ([2f2f7b0](https://github.com/instructure/instructure-ui/commit/2f2f7b04c7d666aef0e76054c9f722dab9f679e7))
13
14
  * **ui-table:** fix caption for table to be responsive to sorting ([aac2b17](https://github.com/instructure/instructure-ui/commit/aac2b1790f970a1e8e2d959723eb0e4248105dd2))
@@ -31,7 +31,7 @@ import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
31
31
  import { View } from '@instructure/ui-view/v11_6';
32
32
  // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
33
33
  // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
34
- import { isSafari } from '@instructure/ui-utils';
34
+ import { isSafari, safeLinkProps } from '@instructure/ui-utils';
35
35
  import { combineDataCid } from '@instructure/ui-utils';
36
36
  import { withStyle } from '@instructure/emotion';
37
37
  import generateStyles from './styles.js';
@@ -223,7 +223,7 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
223
223
  size,
224
224
  elementRef,
225
225
  as,
226
- href,
226
+ href: rawHref,
227
227
  color,
228
228
  focusColor,
229
229
  textAlign,
@@ -247,6 +247,17 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
247
247
  isReadOnly,
248
248
  elementType
249
249
  } = this;
250
+ const {
251
+ href,
252
+ rel
253
+ } = safeLinkProps({
254
+ tag: typeof elementType == 'string' ? elementType : 'button',
255
+ attr: 'href',
256
+ href: rawHref,
257
+ target: props.target,
258
+ rel: props.rel
259
+ });
260
+
250
261
  // only add 0 tabIndex value if it doesn't have it by default, see
251
262
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
252
263
  let needsZeroTabIndex = true;
@@ -277,6 +288,7 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
277
288
  margin: margin,
278
289
  cursor: isDisabled ? 'not-allowed' : cursor,
279
290
  href: href,
291
+ rel: rel,
280
292
  type: href ? undefined : type,
281
293
  elementRef: this.handleElementRef,
282
294
  onClick: this.handleClick,
@@ -32,7 +32,7 @@ import { renderIconWithProps } from '@instructure/ui-icons';
32
32
  import { View } from '@instructure/ui-view/latest';
33
33
  // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
34
34
  // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
35
- import { isSafari } from '@instructure/ui-utils';
35
+ import { isSafari, safeLinkProps } from '@instructure/ui-utils';
36
36
  import { combineDataCid } from '@instructure/ui-utils';
37
37
  import { withStyleNew } from '@instructure/emotion';
38
38
  import generateStyles from './styles.js';
@@ -244,7 +244,7 @@ let BaseButton = (_dec = withStyleNew(generateStyles), _dec(_class = class BaseB
244
244
  size,
245
245
  elementRef,
246
246
  as,
247
- href,
247
+ href: rawHref,
248
248
  color,
249
249
  focusColor,
250
250
  textAlign,
@@ -268,6 +268,17 @@ let BaseButton = (_dec = withStyleNew(generateStyles), _dec(_class = class BaseB
268
268
  isReadOnly,
269
269
  elementType
270
270
  } = this;
271
+ const {
272
+ href,
273
+ rel
274
+ } = safeLinkProps({
275
+ tag: typeof elementType == 'string' ? elementType : 'button',
276
+ attr: 'href',
277
+ href: rawHref,
278
+ target: props.target,
279
+ rel: props.rel
280
+ });
281
+
271
282
  // only add 0 tabIndex value if it doesn't have it by default, see
272
283
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
273
284
  let needsZeroTabIndex = true;
@@ -298,6 +309,7 @@ let BaseButton = (_dec = withStyleNew(generateStyles), _dec(_class = class BaseB
298
309
  margin: margin,
299
310
  cursor: isDisabled ? 'not-allowed' : cursor,
300
311
  href: href,
312
+ rel: rel,
301
313
  type: href ? undefined : type,
302
314
  elementRef: this.handleElementRef,
303
315
  onClick: this.handleClick,
@@ -232,7 +232,7 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
232
232
  size,
233
233
  elementRef,
234
234
  as,
235
- href,
235
+ href: rawHref,
236
236
  color,
237
237
  focusColor,
238
238
  textAlign,
@@ -256,6 +256,17 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
256
256
  isReadOnly,
257
257
  elementType
258
258
  } = this;
259
+ const {
260
+ href,
261
+ rel
262
+ } = (0, _uiUtils.safeLinkProps)({
263
+ tag: typeof elementType == 'string' ? elementType : 'button',
264
+ attr: 'href',
265
+ href: rawHref,
266
+ target: props.target,
267
+ rel: props.rel
268
+ });
269
+
259
270
  // only add 0 tabIndex value if it doesn't have it by default, see
260
271
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
261
272
  let needsZeroTabIndex = true;
@@ -286,6 +297,7 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
286
297
  margin: margin,
287
298
  cursor: isDisabled ? 'not-allowed' : cursor,
288
299
  href: href,
300
+ rel: rel,
289
301
  type: href ? undefined : type,
290
302
  elementRef: this.handleElementRef,
291
303
  onClick: this.handleClick,
@@ -252,7 +252,7 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyleNew)(_styles
252
252
  size,
253
253
  elementRef,
254
254
  as,
255
- href,
255
+ href: rawHref,
256
256
  color,
257
257
  focusColor,
258
258
  textAlign,
@@ -276,6 +276,17 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyleNew)(_styles
276
276
  isReadOnly,
277
277
  elementType
278
278
  } = this;
279
+ const {
280
+ href,
281
+ rel
282
+ } = (0, _uiUtils.safeLinkProps)({
283
+ tag: typeof elementType == 'string' ? elementType : 'button',
284
+ attr: 'href',
285
+ href: rawHref,
286
+ target: props.target,
287
+ rel: props.rel
288
+ });
289
+
279
290
  // only add 0 tabIndex value if it doesn't have it by default, see
280
291
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
281
292
  let needsZeroTabIndex = true;
@@ -306,6 +317,7 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyleNew)(_styles
306
317
  margin: margin,
307
318
  cursor: isDisabled ? 'not-allowed' : cursor,
308
319
  href: href,
320
+ rel: rel,
309
321
  type: href ? undefined : type,
310
322
  elementRef: this.handleElementRef,
311
323
  onClick: this.handleClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-buttons",
3
- "version": "11.7.4-snapshot-135",
3
+ "version": "11.7.4-snapshot-142",
4
4
  "description": "Accessible button components",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -16,28 +16,28 @@
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.29.7",
18
18
  "keycode": "^2",
19
- "@instructure/console": "11.7.4-snapshot-135",
20
- "@instructure/emotion": "11.7.4-snapshot-135",
21
- "@instructure/ui-a11y-content": "11.7.4-snapshot-135",
22
- "@instructure/shared-types": "11.7.4-snapshot-135",
23
- "@instructure/ui-a11y-utils": "11.7.4-snapshot-135",
24
- "@instructure/ui-color-utils": "11.7.4-snapshot-135",
25
- "@instructure/ui-dom-utils": "11.7.4-snapshot-135",
26
- "@instructure/ui-react-utils": "11.7.4-snapshot-135",
27
- "@instructure/ui-position": "11.7.4-snapshot-135",
28
- "@instructure/ui-themes": "11.7.4-snapshot-135",
29
- "@instructure/ui-tooltip": "11.7.4-snapshot-135",
30
- "@instructure/ui-utils": "11.7.4-snapshot-135",
31
- "@instructure/ui-view": "11.7.4-snapshot-135",
32
- "@instructure/ui-icons": "11.7.4-snapshot-135"
19
+ "@instructure/console": "11.7.4-snapshot-142",
20
+ "@instructure/shared-types": "11.7.4-snapshot-142",
21
+ "@instructure/emotion": "11.7.4-snapshot-142",
22
+ "@instructure/ui-a11y-content": "11.7.4-snapshot-142",
23
+ "@instructure/ui-a11y-utils": "11.7.4-snapshot-142",
24
+ "@instructure/ui-color-utils": "11.7.4-snapshot-142",
25
+ "@instructure/ui-icons": "11.7.4-snapshot-142",
26
+ "@instructure/ui-react-utils": "11.7.4-snapshot-142",
27
+ "@instructure/ui-themes": "11.7.4-snapshot-142",
28
+ "@instructure/ui-tooltip": "11.7.4-snapshot-142",
29
+ "@instructure/ui-utils": "11.7.4-snapshot-142",
30
+ "@instructure/ui-dom-utils": "11.7.4-snapshot-142",
31
+ "@instructure/ui-position": "11.7.4-snapshot-142",
32
+ "@instructure/ui-view": "11.7.4-snapshot-142"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@testing-library/jest-dom": "^6.9.1",
36
36
  "@testing-library/react": "16.3.2",
37
37
  "@testing-library/user-event": "^14.6.1",
38
38
  "vitest": "^4.1.9",
39
- "@instructure/ui-axe-check": "11.7.4-snapshot-135",
40
- "@instructure/ui-babel-preset": "11.7.4-snapshot-135"
39
+ "@instructure/ui-axe-check": "11.7.4-snapshot-142",
40
+ "@instructure/ui-babel-preset": "11.7.4-snapshot-142"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": ">=18 <=19"
@@ -38,7 +38,7 @@ import type { ViewProps } from '@instructure/ui-view/v11_6'
38
38
 
39
39
  // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
40
40
  // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
41
- import { isSafari } from '@instructure/ui-utils'
41
+ import { isSafari, safeLinkProps } from '@instructure/ui-utils'
42
42
  import { combineDataCid } from '@instructure/ui-utils'
43
43
 
44
44
  import { withStyle } from '@instructure/emotion'
@@ -239,7 +239,7 @@ class BaseButton extends Component<BaseButtonProps> {
239
239
  size,
240
240
  elementRef,
241
241
  as,
242
- href,
242
+ href: rawHref,
243
243
  color,
244
244
  focusColor,
245
245
  textAlign,
@@ -258,8 +258,15 @@ class BaseButton extends Component<BaseButtonProps> {
258
258
  withFocusOutline,
259
259
  ...props
260
260
  } = this.props
261
-
262
261
  const { isDisabled, isReadOnly, elementType } = this
262
+ const { href, rel } = safeLinkProps({
263
+ tag: typeof elementType == 'string' ? elementType : 'button',
264
+ attr: 'href',
265
+ href: rawHref,
266
+ target: (props as { target?: string }).target,
267
+ rel: (props as { rel?: string }).rel
268
+ })
269
+
263
270
  // only add 0 tabIndex value if it doesn't have it by default, see
264
271
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
265
272
  let needsZeroTabIndex = true
@@ -303,6 +310,7 @@ class BaseButton extends Component<BaseButtonProps> {
303
310
  margin={margin}
304
311
  cursor={isDisabled ? 'not-allowed' : cursor}
305
312
  href={href}
313
+ rel={rel}
306
314
  type={href ? undefined : type}
307
315
  elementRef={this.handleElementRef}
308
316
  onClick={this.handleClick}
@@ -38,7 +38,7 @@ import type { ViewProps } from '@instructure/ui-view/latest'
38
38
 
39
39
  // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
40
40
  // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
41
- import { isSafari } from '@instructure/ui-utils'
41
+ import { isSafari, safeLinkProps } from '@instructure/ui-utils'
42
42
  import { combineDataCid } from '@instructure/ui-utils'
43
43
 
44
44
  import { withStyleNew } from '@instructure/emotion'
@@ -262,7 +262,7 @@ class BaseButton extends Component<BaseButtonProps> {
262
262
  size,
263
263
  elementRef,
264
264
  as,
265
- href,
265
+ href: rawHref,
266
266
  color,
267
267
  focusColor,
268
268
  textAlign,
@@ -283,6 +283,14 @@ class BaseButton extends Component<BaseButtonProps> {
283
283
  } = this.props
284
284
 
285
285
  const { isDisabled, isReadOnly, elementType } = this
286
+ const { href, rel } = safeLinkProps({
287
+ tag: typeof elementType == 'string' ? elementType : 'button',
288
+ attr: 'href',
289
+ href: rawHref,
290
+ target: (props as { target?: string }).target,
291
+ rel: (props as { rel?: string }).rel
292
+ })
293
+
286
294
  // only add 0 tabIndex value if it doesn't have it by default, see
287
295
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
288
296
  let needsZeroTabIndex = true
@@ -326,6 +334,7 @@ class BaseButton extends Component<BaseButtonProps> {
326
334
  margin={margin}
327
335
  cursor={isDisabled ? 'not-allowed' : cursor}
328
336
  href={href}
337
+ rel={rel}
329
338
  type={href ? undefined : type}
330
339
  elementRef={this.handleElementRef}
331
340
  onClick={this.handleClick}