@instructure/ui-modal 7.21.0 → 7.22.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 +10 -0
- package/es/Modal/ModalBody/index.js +40 -5
- package/lib/Modal/ModalBody/index.js +41 -5
- package/package.json +18 -17
- package/src/Modal/ModalBody/index.js +41 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
## [7.22.1](https://github.com/instructure/instructure-ui/compare/v7.22.0...v7.22.1) (2023-01-27)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **ui-modal:** fix screen reader focus order in Chrome ([19aeebe](https://github.com/instructure/instructure-ui/commit/19aeebe))
|
|
11
|
+
|
|
12
|
+
# [7.22.0](https://github.com/instructure/instructure-ui/compare/v7.21.0...v7.22.0) (2023-01-05)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @instructure/ui-modal
|
|
15
|
+
|
|
6
16
|
# [7.21.0](https://github.com/instructure/instructure-ui/compare/v7.20.2...v7.21.0) (2022-09-05)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @instructure/ui-modal
|
|
@@ -38,6 +38,7 @@ import { View } from '@instructure/ui-view';
|
|
|
38
38
|
import { themeable, ThemeablePropTypes } from '@instructure/ui-themeable';
|
|
39
39
|
import { testable } from '@instructure/ui-testable';
|
|
40
40
|
import { isIE11 } from '@instructure/ui-utils';
|
|
41
|
+
import { getComputedStyle } from '@instructure/ui-dom-utils';
|
|
41
42
|
var styles = {
|
|
42
43
|
componentId: 'butxX',
|
|
43
44
|
template: function template(theme) {
|
|
@@ -59,13 +60,43 @@ var ModalBody = (_dec = testable(), _dec2 = themeable(theme, styles), _dec(_clas
|
|
|
59
60
|
|
|
60
61
|
var _super = _createSuper(ModalBody);
|
|
61
62
|
|
|
62
|
-
function ModalBody() {
|
|
63
|
+
function ModalBody(props) {
|
|
64
|
+
var _this;
|
|
65
|
+
|
|
63
66
|
_classCallCheck(this, ModalBody);
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
_this = _super.call(this, props);
|
|
69
|
+
_this.ref = null;
|
|
70
|
+
|
|
71
|
+
_this.handleRef = function (el) {
|
|
72
|
+
var elementRef = _this.props.elementRef;
|
|
73
|
+
_this.ref = el;
|
|
74
|
+
|
|
75
|
+
if (typeof elementRef === 'function') {
|
|
76
|
+
elementRef(el);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
_this.state = {
|
|
81
|
+
isFirefox: false
|
|
82
|
+
};
|
|
83
|
+
return _this;
|
|
66
84
|
}
|
|
67
85
|
|
|
68
86
|
_createClass(ModalBody, [{
|
|
87
|
+
key: "componentDidMount",
|
|
88
|
+
value: function componentDidMount() {
|
|
89
|
+
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
90
|
+
var style = this.ref && getComputedStyle(this.ref);
|
|
91
|
+
var isFirefox = !!(style && Array.prototype.slice.call(style).join('').match(/(?:-moz-)/));
|
|
92
|
+
|
|
93
|
+
if (isFirefox) {
|
|
94
|
+
this.setState({
|
|
95
|
+
isFirefox: isFirefox
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
69
100
|
key: "render",
|
|
70
101
|
value: function render() {
|
|
71
102
|
var _classnames;
|
|
@@ -92,12 +123,16 @@ var ModalBody = (_dec = testable(), _dec2 = themeable(theme, styles), _dec(_clas
|
|
|
92
123
|
display: "block",
|
|
93
124
|
width: isFit ? '100%' : null,
|
|
94
125
|
height: isFit ? '100%' : null,
|
|
95
|
-
elementRef:
|
|
126
|
+
elementRef: this.handleRef,
|
|
96
127
|
as: as,
|
|
97
128
|
className: classes,
|
|
98
|
-
padding: padding,
|
|
99
|
-
|
|
129
|
+
padding: padding // We have to make an exception in Firefox, because it makes
|
|
130
|
+
// the container focusable when it is scrollable.
|
|
131
|
+
// This is a feature, not a bug, but it prevents VoiceOver
|
|
132
|
+
// to correctly focus inside the body in other browsers.
|
|
100
133
|
|
|
134
|
+
}, this.state.isFirefox && {
|
|
135
|
+
tabIndex: -1
|
|
101
136
|
}), children);
|
|
102
137
|
}
|
|
103
138
|
}]);
|
|
@@ -39,6 +39,8 @@ var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
|
39
39
|
|
|
40
40
|
var _isIE = require("@instructure/ui-utils/lib/isIE11.js");
|
|
41
41
|
|
|
42
|
+
var _getComputedStyle = require("@instructure/ui-dom-utils/lib/getComputedStyle.js");
|
|
43
|
+
|
|
42
44
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
43
45
|
|
|
44
46
|
var _dec, _dec2, _class, _class2, _temp;
|
|
@@ -63,12 +65,42 @@ var ModalBody = (_dec = (0, _testable.testable)(), _dec2 = (0, _themeable.themea
|
|
|
63
65
|
|
|
64
66
|
var _super = (0, _createSuper2.default)(ModalBody);
|
|
65
67
|
|
|
66
|
-
function ModalBody() {
|
|
68
|
+
function ModalBody(props) {
|
|
69
|
+
var _this;
|
|
70
|
+
|
|
67
71
|
(0, _classCallCheck2.default)(this, ModalBody);
|
|
68
|
-
|
|
72
|
+
_this = _super.call(this, props);
|
|
73
|
+
_this.ref = null;
|
|
74
|
+
|
|
75
|
+
_this.handleRef = function (el) {
|
|
76
|
+
var elementRef = _this.props.elementRef;
|
|
77
|
+
_this.ref = el;
|
|
78
|
+
|
|
79
|
+
if (typeof elementRef === 'function') {
|
|
80
|
+
elementRef(el);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
_this.state = {
|
|
85
|
+
isFirefox: false
|
|
86
|
+
};
|
|
87
|
+
return _this;
|
|
69
88
|
}
|
|
70
89
|
|
|
71
90
|
(0, _createClass2.default)(ModalBody, [{
|
|
91
|
+
key: "componentDidMount",
|
|
92
|
+
value: function componentDidMount() {
|
|
93
|
+
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
94
|
+
var style = this.ref && (0, _getComputedStyle.getComputedStyle)(this.ref);
|
|
95
|
+
var isFirefox = !!(style && Array.prototype.slice.call(style).join('').match(/(?:-moz-)/));
|
|
96
|
+
|
|
97
|
+
if (isFirefox) {
|
|
98
|
+
this.setState({
|
|
99
|
+
isFirefox: isFirefox
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
72
104
|
key: "render",
|
|
73
105
|
value: function render() {
|
|
74
106
|
var _classnames;
|
|
@@ -93,12 +125,16 @@ var ModalBody = (_dec = (0, _testable.testable)(), _dec2 = (0, _themeable.themea
|
|
|
93
125
|
display: "block",
|
|
94
126
|
width: isFit ? '100%' : null,
|
|
95
127
|
height: isFit ? '100%' : null,
|
|
96
|
-
elementRef:
|
|
128
|
+
elementRef: this.handleRef,
|
|
97
129
|
as: as,
|
|
98
130
|
className: classes,
|
|
99
|
-
padding: padding,
|
|
100
|
-
|
|
131
|
+
padding: padding // We have to make an exception in Firefox, because it makes
|
|
132
|
+
// the container focusable when it is scrollable.
|
|
133
|
+
// This is a feature, not a bug, but it prevents VoiceOver
|
|
134
|
+
// to correctly focus inside the body in other browsers.
|
|
101
135
|
|
|
136
|
+
}, this.state.isFirefox && {
|
|
137
|
+
tabIndex: -1
|
|
102
138
|
}), children);
|
|
103
139
|
}
|
|
104
140
|
}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-modal",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.22.1",
|
|
4
4
|
"description": "A component for displaying content in a dialog overlay",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,18 +23,19 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/runtime": "^7.9.2",
|
|
26
|
-
"@instructure/console": "^7.
|
|
27
|
-
"@instructure/ui-buttons": "^7.
|
|
28
|
-
"@instructure/ui-dialog": "^7.
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
26
|
+
"@instructure/console": "^7.22.1",
|
|
27
|
+
"@instructure/ui-buttons": "^7.22.1",
|
|
28
|
+
"@instructure/ui-dialog": "^7.22.1",
|
|
29
|
+
"@instructure/ui-dom-utils": "^7.22.1",
|
|
30
|
+
"@instructure/ui-motion": "^7.22.1",
|
|
31
|
+
"@instructure/ui-overlays": "^7.22.1",
|
|
32
|
+
"@instructure/ui-portal": "^7.22.1",
|
|
33
|
+
"@instructure/ui-prop-types": "^7.22.1",
|
|
34
|
+
"@instructure/ui-react-utils": "^7.22.1",
|
|
35
|
+
"@instructure/ui-testable": "^7.22.1",
|
|
36
|
+
"@instructure/ui-themeable": "^7.22.1",
|
|
37
|
+
"@instructure/ui-utils": "^7.22.1",
|
|
38
|
+
"@instructure/ui-view": "^7.22.1",
|
|
38
39
|
"classnames": "^2",
|
|
39
40
|
"prop-types": "^15"
|
|
40
41
|
},
|
|
@@ -42,10 +43,10 @@
|
|
|
42
43
|
"react": "^16.8"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@instructure/ui-babel-preset": "^7.
|
|
46
|
-
"@instructure/ui-color-utils": "^7.
|
|
47
|
-
"@instructure/ui-test-locator": "^7.
|
|
48
|
-
"@instructure/ui-test-utils": "^7.
|
|
46
|
+
"@instructure/ui-babel-preset": "^7.22.1",
|
|
47
|
+
"@instructure/ui-color-utils": "^7.22.1",
|
|
48
|
+
"@instructure/ui-test-locator": "^7.22.1",
|
|
49
|
+
"@instructure/ui-test-utils": "^7.22.1"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public"
|
|
@@ -31,6 +31,7 @@ import { themeable, ThemeablePropTypes } from '@instructure/ui-themeable'
|
|
|
31
31
|
import { testable } from '@instructure/ui-testable'
|
|
32
32
|
import { error } from '@instructure/console/macro'
|
|
33
33
|
import { isIE11 } from '@instructure/ui-utils'
|
|
34
|
+
import { getComputedStyle } from '@instructure/ui-dom-utils'
|
|
34
35
|
|
|
35
36
|
import styles from './styles.css'
|
|
36
37
|
import theme from './theme'
|
|
@@ -62,6 +63,40 @@ class ModalBody extends Component {
|
|
|
62
63
|
overflow: undefined
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
ref = null
|
|
67
|
+
|
|
68
|
+
handleRef = (el) => {
|
|
69
|
+
const { elementRef } = this.props
|
|
70
|
+
this.ref = el
|
|
71
|
+
if (typeof elementRef === 'function') {
|
|
72
|
+
elementRef(el)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
constructor(props) {
|
|
77
|
+
super(props)
|
|
78
|
+
|
|
79
|
+
this.state = {
|
|
80
|
+
isFirefox: false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
componentDidMount() {
|
|
85
|
+
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
86
|
+
const style = this.ref && getComputedStyle(this.ref)
|
|
87
|
+
const isFirefox = !!(
|
|
88
|
+
style &&
|
|
89
|
+
Array.prototype.slice
|
|
90
|
+
.call(style)
|
|
91
|
+
.join('')
|
|
92
|
+
.match(/(?:-moz-)/)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
if (isFirefox) {
|
|
96
|
+
this.setState({ isFirefox })
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
65
100
|
render() {
|
|
66
101
|
const {
|
|
67
102
|
as,
|
|
@@ -93,11 +128,15 @@ class ModalBody extends Component {
|
|
|
93
128
|
display="block"
|
|
94
129
|
width={isFit ? '100%' : null}
|
|
95
130
|
height={isFit ? '100%' : null}
|
|
96
|
-
elementRef={
|
|
131
|
+
elementRef={this.handleRef}
|
|
97
132
|
as={as}
|
|
98
133
|
className={classes}
|
|
99
134
|
padding={padding}
|
|
100
|
-
|
|
135
|
+
// We have to make an exception in Firefox, because it makes
|
|
136
|
+
// the container focusable when it is scrollable.
|
|
137
|
+
// This is a feature, not a bug, but it prevents VoiceOver
|
|
138
|
+
// to correctly focus inside the body in other browsers.
|
|
139
|
+
{...(this.state.isFirefox && { tabIndex: -1 })}
|
|
101
140
|
>
|
|
102
141
|
{children}
|
|
103
142
|
</View>
|