@instructure/ui-options 8.53.3-snapshot-20 → 8.53.3-snapshot-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.
- package/CHANGELOG.md +6 -2
- package/es/Options/Item/index.js +9 -5
- package/es/Options/Item/props.js +2 -1
- package/lib/Options/Item/index.js +9 -5
- package/lib/Options/Item/props.js +2 -1
- package/package.json +13 -13
- package/src/Options/Item/index.tsx +12 -5
- package/src/Options/Item/props.ts +6 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Options/Item/index.d.ts +3 -2
- package/types/Options/Item/index.d.ts.map +1 -1
- package/types/Options/Item/props.d.ts +4 -0
- package/types/Options/Item/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,13 @@
|
|
|
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
|
-
## [8.53.3-snapshot-
|
|
6
|
+
## [8.53.3-snapshot-22](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-22) (2024-03-20)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-options:** add prop to move role to the outer tag ([45641ea](https://github.com/instructure/instructure-ui/commit/45641eac2b9efc533238d9399be50762cc45ef82))
|
|
12
|
+
* **ui-options:** update prop name and docs to better describe its purpose ([35ba0b3](https://github.com/instructure/instructure-ui/commit/35ba0b30d4e5589a36ca47bab1c3009251e3cb51))
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
|
package/es/Options/Item/index.js
CHANGED
|
@@ -82,26 +82,29 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
82
82
|
renderBeforeLabel = _this$props4.renderBeforeLabel,
|
|
83
83
|
renderAfterLabel = _this$props4.renderAfterLabel,
|
|
84
84
|
elementRef = _this$props4.elementRef,
|
|
85
|
-
children = _this$props4.children
|
|
85
|
+
children = _this$props4.children,
|
|
86
|
+
voiceoverRoleBugWorkaround = _this$props4.voiceoverRoleBugWorkaround;
|
|
86
87
|
const ElementType = getElementType(Item, this.props, () => as);
|
|
87
88
|
const InnerElementType = href ? 'a' : 'span';
|
|
88
89
|
const passthroughProps = omitProps(this.props, Item.allowedProps);
|
|
89
90
|
const childrenContent = callRenderProp(children);
|
|
90
91
|
const descriptionContent = callRenderProp(description);
|
|
92
|
+
const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
|
|
91
93
|
return jsx(ElementType, {
|
|
92
|
-
role:
|
|
94
|
+
role: voiceoverRoleBugWorkaround ? role : 'none',
|
|
93
95
|
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
94
96
|
ref: element => {
|
|
95
97
|
this.ref = element;
|
|
96
98
|
if (typeof elementRef === 'function') {
|
|
97
99
|
elementRef(element);
|
|
98
100
|
}
|
|
99
|
-
}
|
|
101
|
+
},
|
|
102
|
+
"aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : void 0
|
|
100
103
|
}, jsx(InnerElementType, Object.assign({}, passthroughProps, {
|
|
101
104
|
css: styles === null || styles === void 0 ? void 0 : styles.container,
|
|
102
|
-
role: href ? void 0 : role,
|
|
105
|
+
role: href || voiceoverRoleBugWorkaround ? void 0 : role,
|
|
103
106
|
href: href,
|
|
104
|
-
"aria-describedby":
|
|
107
|
+
"aria-describedby": voiceoverRoleBugWorkaround ? void 0 : ariaDescribedBy
|
|
105
108
|
}), childrenContent, descriptionContent && jsx("span", {
|
|
106
109
|
css: styles === null || styles === void 0 ? void 0 : styles.description,
|
|
107
110
|
role: descriptionRole,
|
|
@@ -112,6 +115,7 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
112
115
|
as: 'span',
|
|
113
116
|
variant: 'default',
|
|
114
117
|
role: 'listitem',
|
|
118
|
+
voiceoverRoleBugWorkaround: false,
|
|
115
119
|
beforeLabelContentVAlign: 'center',
|
|
116
120
|
afterLabelContentVAlign: 'center'
|
|
117
121
|
}, _class2)) || _class) || _class) || _class);
|
package/es/Options/Item/props.js
CHANGED
|
@@ -34,8 +34,9 @@ const propTypes = {
|
|
|
34
34
|
description: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
35
35
|
descriptionRole: PropTypes.string,
|
|
36
36
|
href: PropTypes.string,
|
|
37
|
+
voiceoverRoleBugWorkaround: PropTypes.bool,
|
|
37
38
|
elementRef: PropTypes.func,
|
|
38
39
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
39
40
|
};
|
|
40
|
-
const allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'href', 'elementRef', 'children'];
|
|
41
|
+
const allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'voiceoverRoleBugWorkaround', 'href', 'elementRef', 'children'];
|
|
41
42
|
export { propTypes, allowedProps };
|
|
@@ -87,26 +87,29 @@ let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec
|
|
|
87
87
|
renderBeforeLabel = _this$props4.renderBeforeLabel,
|
|
88
88
|
renderAfterLabel = _this$props4.renderAfterLabel,
|
|
89
89
|
elementRef = _this$props4.elementRef,
|
|
90
|
-
children = _this$props4.children
|
|
90
|
+
children = _this$props4.children,
|
|
91
|
+
voiceoverRoleBugWorkaround = _this$props4.voiceoverRoleBugWorkaround;
|
|
91
92
|
const ElementType = (0, _uiReactUtils.getElementType)(Item, this.props, () => as);
|
|
92
93
|
const InnerElementType = href ? 'a' : 'span';
|
|
93
94
|
const passthroughProps = (0, _uiReactUtils.omitProps)(this.props, Item.allowedProps);
|
|
94
95
|
const childrenContent = (0, _uiReactUtils.callRenderProp)(children);
|
|
95
96
|
const descriptionContent = (0, _uiReactUtils.callRenderProp)(description);
|
|
97
|
+
const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
|
|
96
98
|
return (0, _emotion.jsx)(ElementType, {
|
|
97
|
-
role:
|
|
99
|
+
role: voiceoverRoleBugWorkaround ? role : 'none',
|
|
98
100
|
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
99
101
|
ref: element => {
|
|
100
102
|
this.ref = element;
|
|
101
103
|
if (typeof elementRef === 'function') {
|
|
102
104
|
elementRef(element);
|
|
103
105
|
}
|
|
104
|
-
}
|
|
106
|
+
},
|
|
107
|
+
"aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : void 0
|
|
105
108
|
}, (0, _emotion.jsx)(InnerElementType, Object.assign({}, passthroughProps, {
|
|
106
109
|
css: styles === null || styles === void 0 ? void 0 : styles.container,
|
|
107
|
-
role: href ? void 0 : role,
|
|
110
|
+
role: href || voiceoverRoleBugWorkaround ? void 0 : role,
|
|
108
111
|
href: href,
|
|
109
|
-
"aria-describedby":
|
|
112
|
+
"aria-describedby": voiceoverRoleBugWorkaround ? void 0 : ariaDescribedBy
|
|
110
113
|
}), childrenContent, descriptionContent && (0, _emotion.jsx)("span", {
|
|
111
114
|
css: styles === null || styles === void 0 ? void 0 : styles.description,
|
|
112
115
|
role: descriptionRole,
|
|
@@ -117,6 +120,7 @@ let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec
|
|
|
117
120
|
as: 'span',
|
|
118
121
|
variant: 'default',
|
|
119
122
|
role: 'listitem',
|
|
123
|
+
voiceoverRoleBugWorkaround: false,
|
|
120
124
|
beforeLabelContentVAlign: 'center',
|
|
121
125
|
afterLabelContentVAlign: 'center'
|
|
122
126
|
}, _class2)) || _class) || _class) || _class);
|
|
@@ -41,7 +41,8 @@ const propTypes = exports.propTypes = {
|
|
|
41
41
|
description: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
42
42
|
descriptionRole: _propTypes.default.string,
|
|
43
43
|
href: _propTypes.default.string,
|
|
44
|
+
voiceoverRoleBugWorkaround: _propTypes.default.bool,
|
|
44
45
|
elementRef: _propTypes.default.func,
|
|
45
46
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
|
|
46
47
|
};
|
|
47
|
-
const allowedProps = exports.allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'href', 'elementRef', 'children'];
|
|
48
|
+
const allowedProps = exports.allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'voiceoverRoleBugWorkaround', 'href', 'elementRef', 'children'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-options",
|
|
3
|
-
"version": "8.53.3-snapshot-
|
|
3
|
+
"version": "8.53.3-snapshot-22",
|
|
4
4
|
"description": "A view-only component for composing interactive lists and menus.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.53.3-snapshot-
|
|
27
|
-
"@instructure/ui-color-utils": "8.53.3-snapshot-
|
|
28
|
-
"@instructure/ui-test-locator": "8.53.3-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "8.53.3-snapshot-
|
|
30
|
-
"@instructure/ui-themes": "8.53.3-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.53.3-snapshot-22",
|
|
27
|
+
"@instructure/ui-color-utils": "8.53.3-snapshot-22",
|
|
28
|
+
"@instructure/ui-test-locator": "8.53.3-snapshot-22",
|
|
29
|
+
"@instructure/ui-test-utils": "8.53.3-snapshot-22",
|
|
30
|
+
"@instructure/ui-themes": "8.53.3-snapshot-22"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.23.2",
|
|
34
|
-
"@instructure/emotion": "8.53.3-snapshot-
|
|
35
|
-
"@instructure/shared-types": "8.53.3-snapshot-
|
|
36
|
-
"@instructure/ui-icons": "8.53.3-snapshot-
|
|
37
|
-
"@instructure/ui-prop-types": "8.53.3-snapshot-
|
|
38
|
-
"@instructure/ui-react-utils": "8.53.3-snapshot-
|
|
39
|
-
"@instructure/ui-testable": "8.53.3-snapshot-
|
|
40
|
-
"@instructure/ui-view": "8.53.3-snapshot-
|
|
34
|
+
"@instructure/emotion": "8.53.3-snapshot-22",
|
|
35
|
+
"@instructure/shared-types": "8.53.3-snapshot-22",
|
|
36
|
+
"@instructure/ui-icons": "8.53.3-snapshot-22",
|
|
37
|
+
"@instructure/ui-prop-types": "8.53.3-snapshot-22",
|
|
38
|
+
"@instructure/ui-react-utils": "8.53.3-snapshot-22",
|
|
39
|
+
"@instructure/ui-testable": "8.53.3-snapshot-22",
|
|
40
|
+
"@instructure/ui-view": "8.53.3-snapshot-22",
|
|
41
41
|
"prop-types": "^15.8.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -59,6 +59,7 @@ class Item extends Component<OptionsItemProps> {
|
|
|
59
59
|
as: 'span',
|
|
60
60
|
variant: 'default',
|
|
61
61
|
role: 'listitem',
|
|
62
|
+
voiceoverRoleBugWorkaround: false,
|
|
62
63
|
beforeLabelContentVAlign: 'center',
|
|
63
64
|
afterLabelContentVAlign: 'center'
|
|
64
65
|
} as const
|
|
@@ -118,7 +119,8 @@ class Item extends Component<OptionsItemProps> {
|
|
|
118
119
|
renderBeforeLabel,
|
|
119
120
|
renderAfterLabel,
|
|
120
121
|
elementRef,
|
|
121
|
-
children
|
|
122
|
+
children,
|
|
123
|
+
voiceoverRoleBugWorkaround
|
|
122
124
|
} = this.props
|
|
123
125
|
|
|
124
126
|
const ElementType = getElementType(Item, this.props, () => as!)
|
|
@@ -129,10 +131,13 @@ class Item extends Component<OptionsItemProps> {
|
|
|
129
131
|
|
|
130
132
|
const childrenContent = callRenderProp(children)
|
|
131
133
|
const descriptionContent = callRenderProp(description)
|
|
134
|
+
const ariaDescribedBy =
|
|
135
|
+
this.props['aria-describedby'] ||
|
|
136
|
+
(descriptionContent ? this._descriptionId : undefined)
|
|
132
137
|
|
|
133
138
|
return (
|
|
134
139
|
<ElementType
|
|
135
|
-
role=
|
|
140
|
+
role={voiceoverRoleBugWorkaround ? role : 'none'}
|
|
136
141
|
css={styles?.item}
|
|
137
142
|
ref={(element: Element | null) => {
|
|
138
143
|
this.ref = element
|
|
@@ -141,15 +146,17 @@ class Item extends Component<OptionsItemProps> {
|
|
|
141
146
|
elementRef(element)
|
|
142
147
|
}
|
|
143
148
|
}}
|
|
149
|
+
aria-describedby={
|
|
150
|
+
voiceoverRoleBugWorkaround ? ariaDescribedBy : undefined
|
|
151
|
+
}
|
|
144
152
|
>
|
|
145
153
|
<InnerElementType
|
|
146
154
|
{...passthroughProps}
|
|
147
155
|
css={styles?.container}
|
|
148
|
-
role={href ? undefined : role}
|
|
156
|
+
role={href || voiceoverRoleBugWorkaround ? undefined : role}
|
|
149
157
|
href={href}
|
|
150
158
|
aria-describedby={
|
|
151
|
-
|
|
152
|
-
(descriptionContent ? this._descriptionId : undefined)
|
|
159
|
+
voiceoverRoleBugWorkaround ? undefined : ariaDescribedBy
|
|
153
160
|
}
|
|
154
161
|
>
|
|
155
162
|
{childrenContent}
|
|
@@ -86,6 +86,10 @@ type OptionsItemOwnProps = OptionsItemRenderProps & {
|
|
|
86
86
|
* Providing href will render the option as `<a>`.
|
|
87
87
|
*/
|
|
88
88
|
href?: string
|
|
89
|
+
/**
|
|
90
|
+
* Sometimes VoiceOver doesn't announce the role of the highlighted item. This prop forces the role to be on the outer element and should only be used when such an issue arises.
|
|
91
|
+
*/
|
|
92
|
+
voiceoverRoleBugWorkaround?: boolean
|
|
89
93
|
/**
|
|
90
94
|
* provides a reference to the underlying html root element
|
|
91
95
|
*/
|
|
@@ -127,6 +131,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
127
131
|
description: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
128
132
|
descriptionRole: PropTypes.string,
|
|
129
133
|
href: PropTypes.string,
|
|
134
|
+
voiceoverRoleBugWorkaround: PropTypes.bool,
|
|
130
135
|
elementRef: PropTypes.func,
|
|
131
136
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
132
137
|
}
|
|
@@ -141,6 +146,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
141
146
|
'afterLabelContentVAlign',
|
|
142
147
|
'description',
|
|
143
148
|
'descriptionRole',
|
|
149
|
+
'voiceoverRoleBugWorkaround',
|
|
144
150
|
'href',
|
|
145
151
|
'elementRef',
|
|
146
152
|
'children'
|