@instructure/ui-a11y-utils 8.25.1-snapshot-1 → 8.25.1-snapshot-10

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,7 @@
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.25.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-1) (2022-06-10)
6
+ ## [8.25.1-snapshot-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-a11y-utils
9
9
 
package/es/FocusRegion.js CHANGED
@@ -29,46 +29,16 @@ import { ScreenReaderFocusRegion } from './ScreenReaderFocusRegion';
29
29
  import { KeyboardFocusRegion } from './KeyboardFocusRegion';
30
30
 
31
31
  class FocusRegion {
32
- constructor(element, options) {
33
- this._contextElement = null;
34
- this._preventCloseOnDocumentClick = false;
35
- this._options = void 0;
36
- this._screenReaderFocusRegion = void 0;
37
- this._keyboardFocusRegion = void 0;
38
- this._id = void 0;
39
- this._listeners = [];
40
- this._active = false;
41
-
42
- this.handleDismiss = (event, documentClick) => {
43
- var _this$_options$onDism, _this$_options;
44
-
45
- (_this$_options$onDism = (_this$_options = this._options).onDismiss) === null || _this$_options$onDism === void 0 ? void 0 : _this$_options$onDism.call(_this$_options, event, documentClick);
46
- };
47
-
48
- this.captureDocumentClick = event => {
49
- const target = event.target;
50
- this._preventCloseOnDocumentClick = event.button !== 0 || contains(this._contextElement, target);
51
- };
52
-
53
- this.handleDocumentClick = event => {
54
- if (this._options.shouldCloseOnDocumentClick && !this._preventCloseOnDocumentClick) {
55
- this.handleDismiss(event, true);
56
- }
57
- };
58
-
59
- this.handleFrameClick = (event, frame) => {
60
- if (!contains(this._contextElement, frame)) {
61
- // dismiss if frame is not within the region
62
- this.handleDismiss(event, true);
63
- }
64
- };
65
-
66
- this.handleKeyUp = event => {
67
- if (this._options.shouldCloseOnEscape && event.keyCode === keycode.codes.esc && !event.defaultPrevented) {
68
- this.handleDismiss(event);
69
- }
70
- };
32
+ _contextElement = null;
33
+ _preventCloseOnDocumentClick = false;
34
+ _options;
35
+ _screenReaderFocusRegion;
36
+ _keyboardFocusRegion;
37
+ _id;
38
+ _listeners = [];
39
+ _active = false;
71
40
 
41
+ constructor(element, options) {
72
42
  this._options = options || {
73
43
  shouldCloseOnDocumentClick: true,
74
44
  shouldCloseOnEscape: true
@@ -95,6 +65,32 @@ class FocusRegion {
95
65
  }
96
66
  }
97
67
 
68
+ handleDismiss = (event, documentClick) => {
69
+ var _this$_options$onDism, _this$_options;
70
+
71
+ (_this$_options$onDism = (_this$_options = this._options).onDismiss) === null || _this$_options$onDism === void 0 ? void 0 : _this$_options$onDism.call(_this$_options, event, documentClick);
72
+ };
73
+ captureDocumentClick = event => {
74
+ const target = event.target;
75
+ this._preventCloseOnDocumentClick = event.button !== 0 || contains(this._contextElement, target);
76
+ };
77
+ handleDocumentClick = event => {
78
+ if (this._options.shouldCloseOnDocumentClick && !this._preventCloseOnDocumentClick) {
79
+ this.handleDismiss(event, true);
80
+ }
81
+ };
82
+ handleFrameClick = (event, frame) => {
83
+ if (!contains(this._contextElement, frame)) {
84
+ // dismiss if frame is not within the region
85
+ this.handleDismiss(event, true);
86
+ }
87
+ };
88
+ handleKeyUp = event => {
89
+ if (this._options.shouldCloseOnEscape && event.keyCode === keycode.codes.esc && !event.defaultPrevented) {
90
+ this.handleDismiss(event);
91
+ }
92
+ };
93
+
98
94
  get id() {
99
95
  return this._id;
100
96
  } // Focused returns when the focus region is active. Checking focused with the active element
@@ -25,147 +25,138 @@ import { logError as error } from '@instructure/console';
25
25
  import { FocusRegion } from './FocusRegion';
26
26
  let ENTRIES = [];
27
27
 
28
- class FocusRegionManager {}
29
-
30
- FocusRegionManager.focusRegion = function (element) {
31
- let idOrOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
32
- let entry;
33
-
34
- if (typeof idOrOptions === 'string') {
35
- entry = FocusRegionManager.getEntry(element, idOrOptions);
36
- } else {
37
- entry = FocusRegionManager.addEntry(element, idOrOptions);
38
- }
39
-
40
- if (entry && entry.region && typeof entry.region.focus === 'function') {
41
- entry.region.focus();
42
- return entry.region;
43
- } else {
44
- error(false, `[FocusRegionManager] Could not focus region with element: ${element}`);
45
- }
46
-
47
- return;
48
- };
49
-
50
- FocusRegionManager.activateRegion = (element, options) => {
51
- const _FocusRegionManager$a = FocusRegionManager.addEntry(element, options),
52
- region = _FocusRegionManager$a.region;
53
-
54
- return region;
55
- };
56
-
57
- FocusRegionManager.getActiveEntry = () => {
58
- return ENTRIES.find(_ref => {
59
- let region = _ref.region;
60
- return region.focused;
61
- });
62
- };
63
-
64
- FocusRegionManager.findEntry = (element, id) => {
65
- let index;
66
-
67
- if (id) {
68
- index = ENTRIES.findIndex(entry => entry.id === id);
69
- } else {
70
- index = ENTRIES.findIndex(entry => entry.element === element);
71
- }
72
-
73
- return index;
74
- };
75
-
76
- FocusRegionManager.getEntry = (element, id) => {
77
- return ENTRIES[FocusRegionManager.findEntry(element, id)];
78
- };
79
-
80
- FocusRegionManager.addEntry = function (element) {
81
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
82
- const region = new FocusRegion(element, options);
83
- const activeEntry = FocusRegionManager.getActiveEntry();
84
- const keyboardFocusable = region.keyboardFocusable;
85
- ENTRIES.forEach(_ref2 => {
86
- let region = _ref2.region;
87
-
88
- if (region) {
89
- // If the active region is triggering a new focus region that does not have
90
- // keyboard focusable content, don't deactivate the active region's keyboard
91
- // focus region
92
- const keyboard = region.focused && !keyboardFocusable ? {
93
- keyboard: false
94
- } : void 0;
95
- region.deactivate(keyboard);
28
+ class FocusRegionManager {
29
+ static focusRegion = function (element) {
30
+ let idOrOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
31
+ let entry;
32
+
33
+ if (typeof idOrOptions === 'string') {
34
+ entry = FocusRegionManager.getEntry(element, idOrOptions);
35
+ } else {
36
+ entry = FocusRegionManager.addEntry(element, idOrOptions);
96
37
  }
97
- });
98
- region.activate();
99
-
100
- if (options.shouldFocusOnOpen) {
101
- region.focus();
102
- }
103
-
104
- const entry = {
105
- id: region.id,
106
- element,
107
- region,
108
- children: [],
109
- parent: activeEntry
110
- };
111
- ENTRIES.push(entry);
112
38
 
113
- if (activeEntry) {
114
- activeEntry.children.push(entry);
115
- }
39
+ if (entry && entry.region && typeof entry.region.focus === 'function') {
40
+ entry.region.focus();
41
+ return entry.region;
42
+ } else {
43
+ error(false, `[FocusRegionManager] Could not focus region with element: ${element}`);
44
+ }
116
45
 
117
- return entry;
118
- };
46
+ return;
47
+ };
48
+ static activateRegion = (element, options) => {
49
+ const _FocusRegionManager$a = FocusRegionManager.addEntry(element, options),
50
+ region = _FocusRegionManager$a.region;
119
51
 
120
- FocusRegionManager.removeEntry = (element, id) => {
121
- const index = FocusRegionManager.findEntry(element, id);
122
- const entry = ENTRIES[index];
52
+ return region;
53
+ };
54
+ static getActiveEntry = () => {
55
+ return ENTRIES.find(_ref => {
56
+ let region = _ref.region;
57
+ return region.focused;
58
+ });
59
+ };
60
+ static findEntry = (element, id) => {
61
+ let index;
123
62
 
124
- if (index > -1) {
125
- ENTRIES.splice(index, 1);
126
- }
63
+ if (id) {
64
+ index = ENTRIES.findIndex(entry => entry.id === id);
65
+ } else {
66
+ index = ENTRIES.findIndex(entry => entry.element === element);
67
+ }
127
68
 
128
- return entry;
129
- };
69
+ return index;
70
+ };
71
+ static getEntry = (element, id) => {
72
+ return ENTRIES[FocusRegionManager.findEntry(element, id)];
73
+ };
74
+ static addEntry = function (element) {
75
+ let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
76
+ const region = new FocusRegion(element, options);
77
+ const activeEntry = FocusRegionManager.getActiveEntry();
78
+ const keyboardFocusable = region.keyboardFocusable;
79
+ ENTRIES.forEach(_ref2 => {
80
+ let region = _ref2.region;
81
+
82
+ if (region) {
83
+ // If the active region is triggering a new focus region that does not have
84
+ // keyboard focusable content, don't deactivate the active region's keyboard
85
+ // focus region
86
+ const keyboard = region.focused && !keyboardFocusable ? {
87
+ keyboard: false
88
+ } : void 0;
89
+ region.deactivate(keyboard);
90
+ }
91
+ });
92
+ region.activate();
93
+
94
+ if (options.shouldFocusOnOpen) {
95
+ region.focus();
96
+ }
130
97
 
131
- FocusRegionManager.isFocused = (element, id) => {
132
- const entry = FocusRegionManager.getActiveEntry();
98
+ const entry = {
99
+ id: region.id,
100
+ element,
101
+ region,
102
+ children: [],
103
+ parent: activeEntry
104
+ };
105
+ ENTRIES.push(entry);
106
+
107
+ if (activeEntry) {
108
+ activeEntry.children.push(entry);
109
+ }
133
110
 
134
- if (id) {
135
- return entry && entry.region && entry.id === id;
136
- } else {
137
- return entry && entry.region && entry.element === element;
138
- }
139
- };
111
+ return entry;
112
+ };
113
+ static removeEntry = (element, id) => {
114
+ const index = FocusRegionManager.findEntry(element, id);
115
+ const entry = ENTRIES[index];
140
116
 
141
- FocusRegionManager.clearEntries = () => {
142
- ENTRIES = [];
143
- };
117
+ if (index > -1) {
118
+ ENTRIES.splice(index, 1);
119
+ }
144
120
 
145
- FocusRegionManager.blurRegion = (element, id) => {
146
- const entry = FocusRegionManager.removeEntry(element, id);
121
+ return entry;
122
+ };
123
+ static isFocused = (element, id) => {
124
+ const entry = FocusRegionManager.getActiveEntry();
147
125
 
148
- if (entry) {
149
- const children = entry.children,
150
- region = entry.region,
151
- parent = entry.parent; // deactivate the region...
126
+ if (id) {
127
+ return entry && entry.region && entry.id === id;
128
+ } else {
129
+ return entry && entry.region && entry.element === element;
130
+ }
131
+ };
132
+ static clearEntries = () => {
133
+ ENTRIES = [];
134
+ };
135
+ static blurRegion = (element, id) => {
136
+ const entry = FocusRegionManager.removeEntry(element, id);
137
+
138
+ if (entry) {
139
+ const children = entry.children,
140
+ region = entry.region,
141
+ parent = entry.parent; // deactivate the region...
152
142
 
153
- region && region.deactivate(); // and any regions created from it
143
+ region && region.deactivate(); // and any regions created from it
154
144
 
155
- if (children) {
156
- children.forEach(_ref3 => {
157
- let id = _ref3.id,
158
- element = _ref3.element;
159
- const entry = FocusRegionManager.removeEntry(element, id);
160
- entry && entry.region && entry.region.deactivate();
161
- });
162
- } // activate the region's parent if it exists
145
+ if (children) {
146
+ children.forEach(_ref3 => {
147
+ let id = _ref3.id,
148
+ element = _ref3.element;
149
+ const entry = FocusRegionManager.removeEntry(element, id);
150
+ entry && entry.region && entry.region.deactivate();
151
+ });
152
+ } // activate the region's parent if it exists
163
153
 
164
154
 
165
- parent && parent.region && parent.region.activate();
166
- region && region.blur(); // this should focus the parent region
167
- }
168
- };
155
+ parent && parent.region && parent.region.activate();
156
+ region && region.blur(); // this should focus the parent region
157
+ }
158
+ };
159
+ }
169
160
 
170
161
  export default FocusRegionManager;
171
162
  export {
@@ -27,74 +27,16 @@ import keycode from 'keycode';
27
27
  import { scopeTab } from './scopeTab';
28
28
 
29
29
  class KeyboardFocusRegion {
30
- constructor(element, options) {
31
- this._options = void 0;
32
- this._focusLaterElement = null;
33
- this._needToFocus = false;
34
- this._listeners = [];
35
- this._raf = [];
36
- this._active = false;
37
- this._wasDocumentClick = void 0;
38
- this._contextElement = void 0;
39
-
40
- this.handleKeyDown = event => {
41
- if (event.keyCode === keycode.codes.tab) {
42
- scopeTab(this._contextElement, event);
43
- }
44
- };
45
-
46
- this.handleClick = () => {
47
- this._wasDocumentClick = true;
48
- };
49
-
50
- this.handleWindowBlur = () => {
51
- if (this._wasDocumentClick) {
52
- this._wasDocumentClick = false;
53
- return;
54
- }
55
-
56
- this._needToFocus = true;
57
- };
58
-
59
- this.handleFocus = () => {
60
- if (this._needToFocus) {
61
- this._needToFocus = false;
62
-
63
- if (!this._contextElement) {
64
- return;
65
- } // need to see how jQuery shims document.on('focusin') so we don't need the
66
- // setTimeout, firefox doesn't support focusin, if it did, we could focus
67
- // the element outside of a setTimeout. Side-effect of this implementation
68
- // is that the document.body gets focus, and then we focus our element right
69
- // after, seems fine.
70
-
71
-
72
- this._raf.push(requestAnimationFrame(() => {
73
- if (containsActiveElement(this._contextElement)) {
74
- return;
75
- }
76
-
77
- this.focusDefaultElement();
78
- }));
79
- }
80
- };
81
-
82
- this.handleFirstTabbableKeyDown = event => {
83
- if (event.keyCode === keycode.codes.tab && event.shiftKey) {
84
- var _this$_options$onBlur, _this$_options;
85
-
86
- (_this$_options$onBlur = (_this$_options = this._options).onBlur) === null || _this$_options$onBlur === void 0 ? void 0 : _this$_options$onBlur.call(_this$_options, event);
87
- }
88
- };
89
-
90
- this.handleLastTabbableKeyDown = event => {
91
- if (event.keyCode === keycode.codes.tab && !event.shiftKey) {
92
- var _this$_options$onBlur2, _this$_options2;
93
-
94
- (_this$_options$onBlur2 = (_this$_options2 = this._options).onBlur) === null || _this$_options$onBlur2 === void 0 ? void 0 : _this$_options$onBlur2.call(_this$_options2, event);
95
- }
96
- };
30
+ _options;
31
+ _focusLaterElement = null;
32
+ _needToFocus = false;
33
+ _listeners = [];
34
+ _raf = [];
35
+ _active = false;
36
+ _wasDocumentClick;
37
+ _contextElement;
97
38
 
39
+ constructor(element, options) {
98
40
  this._contextElement = findDOMNode(element);
99
41
  this._options = options || {
100
42
  shouldContainFocus: true,
@@ -214,6 +156,59 @@ class KeyboardFocusRegion {
214
156
  }
215
157
  }
216
158
 
159
+ handleKeyDown = event => {
160
+ if (event.keyCode === keycode.codes.tab) {
161
+ scopeTab(this._contextElement, event);
162
+ }
163
+ };
164
+ handleClick = () => {
165
+ this._wasDocumentClick = true;
166
+ };
167
+ handleWindowBlur = () => {
168
+ if (this._wasDocumentClick) {
169
+ this._wasDocumentClick = false;
170
+ return;
171
+ }
172
+
173
+ this._needToFocus = true;
174
+ };
175
+ handleFocus = () => {
176
+ if (this._needToFocus) {
177
+ this._needToFocus = false;
178
+
179
+ if (!this._contextElement) {
180
+ return;
181
+ } // need to see how jQuery shims document.on('focusin') so we don't need the
182
+ // setTimeout, firefox doesn't support focusin, if it did, we could focus
183
+ // the element outside of a setTimeout. Side-effect of this implementation
184
+ // is that the document.body gets focus, and then we focus our element right
185
+ // after, seems fine.
186
+
187
+
188
+ this._raf.push(requestAnimationFrame(() => {
189
+ if (containsActiveElement(this._contextElement)) {
190
+ return;
191
+ }
192
+
193
+ this.focusDefaultElement();
194
+ }));
195
+ }
196
+ };
197
+ handleFirstTabbableKeyDown = event => {
198
+ if (event.keyCode === keycode.codes.tab && event.shiftKey) {
199
+ var _this$_options$onBlur, _this$_options;
200
+
201
+ (_this$_options$onBlur = (_this$_options = this._options).onBlur) === null || _this$_options$onBlur === void 0 ? void 0 : _this$_options$onBlur.call(_this$_options, event);
202
+ }
203
+ };
204
+ handleLastTabbableKeyDown = event => {
205
+ if (event.keyCode === keycode.codes.tab && !event.shiftKey) {
206
+ var _this$_options$onBlur2, _this$_options2;
207
+
208
+ (_this$_options$onBlur2 = (_this$_options2 = this._options).onBlur) === null || _this$_options$onBlur2 === void 0 ? void 0 : _this$_options$onBlur2.call(_this$_options2, event);
209
+ }
210
+ };
211
+
217
212
  activate() {
218
213
  const defaultFocusElement = this.defaultFocusElement,
219
214
  shouldContainFocus = this.shouldContainFocus;
@@ -24,39 +24,19 @@
24
24
  import { logWarn as warn } from '@instructure/console';
25
25
 
26
26
  class ScreenReaderFocusRegion {
27
+ _parents = [];
28
+ _nodes = [];
29
+ _liveRegion;
30
+ _contextElement;
31
+ _options;
32
+ _observer = null;
33
+ _attributes = [];
34
+
27
35
  constructor(element) {
28
36
  let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
29
37
  shouldContainFocus: true,
30
38
  liveRegion: []
31
39
  };
32
- this._parents = [];
33
- this._nodes = [];
34
- this._liveRegion = void 0;
35
- this._contextElement = void 0;
36
- this._options = void 0;
37
- this._observer = null;
38
- this._attributes = [];
39
-
40
- this.handleDOMMutation = records => {
41
- records.forEach(record => {
42
- const addedNodes = Array.from(record.addedNodes);
43
- const removedNodes = Array.from(record.removedNodes);
44
- this.hideNodes(addedNodes);
45
- removedNodes.forEach(removedNode => {
46
- // Node has been removed from the DOM, make sure it is
47
- // removed from our list of hidden nodes as well
48
- if (removedNode.tagName.toLowerCase() !== 'iframe') {
49
- this.restoreNode(removedNode);
50
- }
51
-
52
- const iframeBodies = this.parseIframeBodies(removedNode);
53
- iframeBodies.forEach(iframeBody => {
54
- this.restoreNode(iframeBody);
55
- });
56
- });
57
- });
58
- };
59
-
60
40
  const liveRegion = typeof options.liveRegion === 'function' ? options.liveRegion() : options.liveRegion;
61
41
  this._liveRegion = Array.isArray(liveRegion) ? liveRegion : [liveRegion];
62
42
  this._contextElement = element;
@@ -120,6 +100,26 @@ class ScreenReaderFocusRegion {
120
100
  }
121
101
  }
122
102
 
103
+ handleDOMMutation = records => {
104
+ records.forEach(record => {
105
+ const addedNodes = Array.from(record.addedNodes);
106
+ const removedNodes = Array.from(record.removedNodes);
107
+ this.hideNodes(addedNodes);
108
+ removedNodes.forEach(removedNode => {
109
+ // Node has been removed from the DOM, make sure it is
110
+ // removed from our list of hidden nodes as well
111
+ if (removedNode.tagName.toLowerCase() !== 'iframe') {
112
+ this.restoreNode(removedNode);
113
+ }
114
+
115
+ const iframeBodies = this.parseIframeBodies(removedNode);
116
+ iframeBodies.forEach(iframeBody => {
117
+ this.restoreNode(iframeBody);
118
+ });
119
+ });
120
+ });
121
+ };
122
+
123
123
  restoreNode(removedNode) {
124
124
  const index = this._nodes.indexOf(removedNode);
125
125
 
@@ -49,46 +49,16 @@ var _KeyboardFocusRegion = require("./KeyboardFocusRegion");
49
49
  * SOFTWARE.
50
50
  */
51
51
  class FocusRegion {
52
- constructor(element, options) {
53
- this._contextElement = null;
54
- this._preventCloseOnDocumentClick = false;
55
- this._options = void 0;
56
- this._screenReaderFocusRegion = void 0;
57
- this._keyboardFocusRegion = void 0;
58
- this._id = void 0;
59
- this._listeners = [];
60
- this._active = false;
61
-
62
- this.handleDismiss = (event, documentClick) => {
63
- var _this$_options$onDism, _this$_options;
64
-
65
- (_this$_options$onDism = (_this$_options = this._options).onDismiss) === null || _this$_options$onDism === void 0 ? void 0 : _this$_options$onDism.call(_this$_options, event, documentClick);
66
- };
67
-
68
- this.captureDocumentClick = event => {
69
- const target = event.target;
70
- this._preventCloseOnDocumentClick = event.button !== 0 || (0, _contains.contains)(this._contextElement, target);
71
- };
72
-
73
- this.handleDocumentClick = event => {
74
- if (this._options.shouldCloseOnDocumentClick && !this._preventCloseOnDocumentClick) {
75
- this.handleDismiss(event, true);
76
- }
77
- };
78
-
79
- this.handleFrameClick = (event, frame) => {
80
- if (!(0, _contains.contains)(this._contextElement, frame)) {
81
- // dismiss if frame is not within the region
82
- this.handleDismiss(event, true);
83
- }
84
- };
85
-
86
- this.handleKeyUp = event => {
87
- if (this._options.shouldCloseOnEscape && event.keyCode === _keycode.default.codes.esc && !event.defaultPrevented) {
88
- this.handleDismiss(event);
89
- }
90
- };
52
+ _contextElement = null;
53
+ _preventCloseOnDocumentClick = false;
54
+ _options;
55
+ _screenReaderFocusRegion;
56
+ _keyboardFocusRegion;
57
+ _id;
58
+ _listeners = [];
59
+ _active = false;
91
60
 
61
+ constructor(element, options) {
92
62
  this._options = options || {
93
63
  shouldCloseOnDocumentClick: true,
94
64
  shouldCloseOnEscape: true
@@ -115,6 +85,32 @@ class FocusRegion {
115
85
  }
116
86
  }
117
87
 
88
+ handleDismiss = (event, documentClick) => {
89
+ var _this$_options$onDism, _this$_options;
90
+
91
+ (_this$_options$onDism = (_this$_options = this._options).onDismiss) === null || _this$_options$onDism === void 0 ? void 0 : _this$_options$onDism.call(_this$_options, event, documentClick);
92
+ };
93
+ captureDocumentClick = event => {
94
+ const target = event.target;
95
+ this._preventCloseOnDocumentClick = event.button !== 0 || (0, _contains.contains)(this._contextElement, target);
96
+ };
97
+ handleDocumentClick = event => {
98
+ if (this._options.shouldCloseOnDocumentClick && !this._preventCloseOnDocumentClick) {
99
+ this.handleDismiss(event, true);
100
+ }
101
+ };
102
+ handleFrameClick = (event, frame) => {
103
+ if (!(0, _contains.contains)(this._contextElement, frame)) {
104
+ // dismiss if frame is not within the region
105
+ this.handleDismiss(event, true);
106
+ }
107
+ };
108
+ handleKeyUp = event => {
109
+ if (this._options.shouldCloseOnEscape && event.keyCode === _keycode.default.codes.esc && !event.defaultPrevented) {
110
+ this.handleDismiss(event);
111
+ }
112
+ };
113
+
118
114
  get id() {
119
115
  return this._id;
120
116
  } // Focused returns when the focus region is active. Checking focused with the active element