@instructure/ui-drilldown 10.18.1-snapshot-5 → 10.18.1-snapshot-7

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,9 +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
- ## [10.18.1-snapshot-5](https://github.com/instructure/instructure-ui/compare/v10.18.0...v10.18.1-snapshot-5) (2025-05-29)
6
+ ## [10.18.1-snapshot-7](https://github.com/instructure/instructure-ui/compare/v10.18.0...v10.18.1-snapshot-7) (2025-05-29)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-drilldown
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-top-nav-bar,ui-popover,ui-drilldown:** fix Drilldown's and TopNavBar's keyboard navigation issues ([6d7d3fa](https://github.com/instructure/instructure-ui/commit/6d7d3faa6c9fe8e7f2b987cb11ec2d9b00732d5b))
9
12
 
10
13
 
11
14
 
@@ -331,7 +331,20 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
331
331
  }
332
332
  };
333
333
  this.handleToggle = (event, shown) => {
334
- const onToggle = this.props.onToggle;
334
+ const _this$props2 = this.props,
335
+ onToggle = _this$props2.onToggle,
336
+ trigger = _this$props2.trigger;
337
+ if (trigger && shown && this.currentPage) {
338
+ var _this$currentPage$chi;
339
+ const actionLabel = callRenderProp(this.currentPage.renderActionLabel);
340
+ // Use action ID if exists, otherwise first non-action option's ID
341
+ const targetId = actionLabel ? this._headerActionId : (_this$currentPage$chi = this.currentPage.children[0]) === null || _this$currentPage$chi === void 0 ? void 0 : _this$currentPage$chi.props.id;
342
+ setTimeout(() => {
343
+ this.setState({
344
+ highlightedOptionId: targetId
345
+ });
346
+ }, 10);
347
+ }
335
348
  this.setState({
336
349
  isShowingPopover: shown
337
350
  });
@@ -359,12 +372,12 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
359
372
  this._headerActionId = props.deterministicId('DrilldownHeader-Action');
360
373
  }
361
374
  componentDidMount() {
362
- var _this$props$makeStyle, _this$props2;
363
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
375
+ var _this$props$makeStyle, _this$props3;
376
+ (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3, this.makeStylesVariables);
364
377
  }
365
378
  componentDidUpdate(_prevProps, prevState) {
366
- var _this$props$makeStyle2, _this$props3;
367
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
379
+ var _this$props$makeStyle2, _this$props4;
380
+ (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4, this.makeStylesVariables);
368
381
  if (prevState.activePageId !== this.state.activePageId) {
369
382
  // on page change with mouse navigation, some option can get rendered
370
383
  // under the cursor and get focused, so we need to wait a tick to see
@@ -531,9 +544,9 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
531
544
  }
532
545
  get headerChildren() {
533
546
  const currentPage = this.currentPage;
534
- const _this$props4 = this.props,
535
- styles = _this$props4.styles,
536
- deterministicId = _this$props4.deterministicId;
547
+ const _this$props5 = this.props,
548
+ styles = _this$props5.styles,
549
+ deterministicId = _this$props5.deterministicId;
537
550
  const headerChildren = [];
538
551
  if (!currentPage) {
539
552
  return headerChildren;
@@ -1011,19 +1024,19 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
1011
1024
  return groupChildren;
1012
1025
  }
1013
1026
  renderPage() {
1014
- const _this$props5 = this.props,
1015
- styles = _this$props5.styles,
1016
- overflowY = _this$props5.overflowY,
1017
- overflowX = _this$props5.overflowX,
1018
- height = _this$props5.height,
1019
- width = _this$props5.width,
1020
- minHeight = _this$props5.minHeight,
1021
- minWidth = _this$props5.minWidth,
1022
- maxHeight = _this$props5.maxHeight,
1023
- maxWidth = _this$props5.maxWidth,
1024
- role = _this$props5.role,
1025
- as = _this$props5.as,
1026
- label = _this$props5.label;
1027
+ const _this$props6 = this.props,
1028
+ styles = _this$props6.styles,
1029
+ overflowY = _this$props6.overflowY,
1030
+ overflowX = _this$props6.overflowX,
1031
+ height = _this$props6.height,
1032
+ width = _this$props6.width,
1033
+ minHeight = _this$props6.minHeight,
1034
+ minWidth = _this$props6.minWidth,
1035
+ maxHeight = _this$props6.maxHeight,
1036
+ maxWidth = _this$props6.maxWidth,
1037
+ role = _this$props6.role,
1038
+ as = _this$props6.as,
1039
+ label = _this$props6.label;
1027
1040
  if (!this.currentPage) {
1028
1041
  return null;
1029
1042
  }
@@ -1123,25 +1136,25 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
1123
1136
  render() {
1124
1137
  // clear temporary option store
1125
1138
  this._activeOptionsMap = {};
1126
- const _this$props6 = this.props,
1127
- show = _this$props6.show,
1128
- defaultShow = _this$props6.defaultShow,
1129
- placement = _this$props6.placement,
1130
- withArrow = _this$props6.withArrow,
1131
- shouldContainFocus = _this$props6.shouldContainFocus,
1132
- shouldReturnFocus = _this$props6.shouldReturnFocus,
1133
- trigger = _this$props6.trigger,
1134
- mountNode = _this$props6.mountNode,
1135
- constrain = _this$props6.constrain,
1136
- positionTarget = _this$props6.positionTarget,
1137
- positionContainerDisplay = _this$props6.positionContainerDisplay,
1138
- popoverRef = _this$props6.popoverRef,
1139
- disabled = _this$props6.disabled,
1140
- onDismiss = _this$props6.onDismiss,
1141
- onFocus = _this$props6.onFocus,
1142
- onMouseOver = _this$props6.onMouseOver,
1143
- offsetX = _this$props6.offsetX,
1144
- offsetY = _this$props6.offsetY;
1139
+ const _this$props7 = this.props,
1140
+ show = _this$props7.show,
1141
+ defaultShow = _this$props7.defaultShow,
1142
+ placement = _this$props7.placement,
1143
+ withArrow = _this$props7.withArrow,
1144
+ shouldContainFocus = _this$props7.shouldContainFocus,
1145
+ shouldReturnFocus = _this$props7.shouldReturnFocus,
1146
+ trigger = _this$props7.trigger,
1147
+ mountNode = _this$props7.mountNode,
1148
+ constrain = _this$props7.constrain,
1149
+ positionTarget = _this$props7.positionTarget,
1150
+ positionContainerDisplay = _this$props7.positionContainerDisplay,
1151
+ popoverRef = _this$props7.popoverRef,
1152
+ disabled = _this$props7.disabled,
1153
+ onDismiss = _this$props7.onDismiss,
1154
+ onFocus = _this$props7.onFocus,
1155
+ onMouseOver = _this$props7.onMouseOver,
1156
+ offsetX = _this$props7.offsetX,
1157
+ offsetY = _this$props7.offsetY;
1145
1158
  return trigger ? _jsx(Popover, {
1146
1159
  isShowingContent: show,
1147
1160
  defaultIsShowingContent: defaultShow,
@@ -1156,7 +1169,7 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
1156
1169
  this.handleToggle(event, false);
1157
1170
  },
1158
1171
  onShowContent: event => this.handleToggle(event, true),
1159
- mountNode: mountNode,
1172
+ mountNode: mountNode || this.ref,
1160
1173
  placement: placement,
1161
1174
  withArrow: withArrow,
1162
1175
  positionTarget: positionTarget,
@@ -1170,6 +1183,15 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
1170
1183
  onMouseOver: onMouseOver,
1171
1184
  offsetX: offsetX,
1172
1185
  offsetY: offsetY,
1186
+ defaultFocusElement: () => {
1187
+ var _this$currentPage$chi2, _this$_popover2, _this$_popover2$_cont;
1188
+ if (!this.currentPage) return null;
1189
+ const actionLabel = callRenderProp(this.currentPage.renderActionLabel);
1190
+ // Use action ID if exists, otherwise first non-action option's ID
1191
+ const targetId = actionLabel ? this._headerActionId : (_this$currentPage$chi2 = this.currentPage.children[0]) === null || _this$currentPage$chi2 === void 0 ? void 0 : _this$currentPage$chi2.props.id;
1192
+ if (!targetId) return null;
1193
+ return (_this$_popover2 = this._popover) === null || _this$_popover2 === void 0 ? void 0 : (_this$_popover2$_cont = _this$_popover2._contentElement) === null || _this$_popover2$_cont === void 0 ? void 0 : _this$_popover2$_cont.querySelector(`#${targetId}`);
1194
+ },
1173
1195
  elementRef: element => {
1174
1196
  // setting ref for "Popover" version, the popover root
1175
1197
  // (if there is no trigger, we set it in handleDrilldownRef)
@@ -340,7 +340,20 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
340
340
  }
341
341
  };
342
342
  this.handleToggle = (event, shown) => {
343
- const onToggle = this.props.onToggle;
343
+ const _this$props2 = this.props,
344
+ onToggle = _this$props2.onToggle,
345
+ trigger = _this$props2.trigger;
346
+ if (trigger && shown && this.currentPage) {
347
+ var _this$currentPage$chi;
348
+ const actionLabel = (0, _callRenderProp.callRenderProp)(this.currentPage.renderActionLabel);
349
+ // Use action ID if exists, otherwise first non-action option's ID
350
+ const targetId = actionLabel ? this._headerActionId : (_this$currentPage$chi = this.currentPage.children[0]) === null || _this$currentPage$chi === void 0 ? void 0 : _this$currentPage$chi.props.id;
351
+ setTimeout(() => {
352
+ this.setState({
353
+ highlightedOptionId: targetId
354
+ });
355
+ }, 10);
356
+ }
344
357
  this.setState({
345
358
  isShowingPopover: shown
346
359
  });
@@ -368,12 +381,12 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
368
381
  this._headerActionId = props.deterministicId('DrilldownHeader-Action');
369
382
  }
370
383
  componentDidMount() {
371
- var _this$props$makeStyle, _this$props2;
372
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
384
+ var _this$props$makeStyle, _this$props3;
385
+ (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3, this.makeStylesVariables);
373
386
  }
374
387
  componentDidUpdate(_prevProps, prevState) {
375
- var _this$props$makeStyle2, _this$props3;
376
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
388
+ var _this$props$makeStyle2, _this$props4;
389
+ (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4, this.makeStylesVariables);
377
390
  if (prevState.activePageId !== this.state.activePageId) {
378
391
  // on page change with mouse navigation, some option can get rendered
379
392
  // under the cursor and get focused, so we need to wait a tick to see
@@ -540,9 +553,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
540
553
  }
541
554
  get headerChildren() {
542
555
  const currentPage = this.currentPage;
543
- const _this$props4 = this.props,
544
- styles = _this$props4.styles,
545
- deterministicId = _this$props4.deterministicId;
556
+ const _this$props5 = this.props,
557
+ styles = _this$props5.styles,
558
+ deterministicId = _this$props5.deterministicId;
546
559
  const headerChildren = [];
547
560
  if (!currentPage) {
548
561
  return headerChildren;
@@ -1020,19 +1033,19 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
1020
1033
  return groupChildren;
1021
1034
  }
1022
1035
  renderPage() {
1023
- const _this$props5 = this.props,
1024
- styles = _this$props5.styles,
1025
- overflowY = _this$props5.overflowY,
1026
- overflowX = _this$props5.overflowX,
1027
- height = _this$props5.height,
1028
- width = _this$props5.width,
1029
- minHeight = _this$props5.minHeight,
1030
- minWidth = _this$props5.minWidth,
1031
- maxHeight = _this$props5.maxHeight,
1032
- maxWidth = _this$props5.maxWidth,
1033
- role = _this$props5.role,
1034
- as = _this$props5.as,
1035
- label = _this$props5.label;
1036
+ const _this$props6 = this.props,
1037
+ styles = _this$props6.styles,
1038
+ overflowY = _this$props6.overflowY,
1039
+ overflowX = _this$props6.overflowX,
1040
+ height = _this$props6.height,
1041
+ width = _this$props6.width,
1042
+ minHeight = _this$props6.minHeight,
1043
+ minWidth = _this$props6.minWidth,
1044
+ maxHeight = _this$props6.maxHeight,
1045
+ maxWidth = _this$props6.maxWidth,
1046
+ role = _this$props6.role,
1047
+ as = _this$props6.as,
1048
+ label = _this$props6.label;
1036
1049
  if (!this.currentPage) {
1037
1050
  return null;
1038
1051
  }
@@ -1132,25 +1145,25 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
1132
1145
  render() {
1133
1146
  // clear temporary option store
1134
1147
  this._activeOptionsMap = {};
1135
- const _this$props6 = this.props,
1136
- show = _this$props6.show,
1137
- defaultShow = _this$props6.defaultShow,
1138
- placement = _this$props6.placement,
1139
- withArrow = _this$props6.withArrow,
1140
- shouldContainFocus = _this$props6.shouldContainFocus,
1141
- shouldReturnFocus = _this$props6.shouldReturnFocus,
1142
- trigger = _this$props6.trigger,
1143
- mountNode = _this$props6.mountNode,
1144
- constrain = _this$props6.constrain,
1145
- positionTarget = _this$props6.positionTarget,
1146
- positionContainerDisplay = _this$props6.positionContainerDisplay,
1147
- popoverRef = _this$props6.popoverRef,
1148
- disabled = _this$props6.disabled,
1149
- onDismiss = _this$props6.onDismiss,
1150
- onFocus = _this$props6.onFocus,
1151
- onMouseOver = _this$props6.onMouseOver,
1152
- offsetX = _this$props6.offsetX,
1153
- offsetY = _this$props6.offsetY;
1148
+ const _this$props7 = this.props,
1149
+ show = _this$props7.show,
1150
+ defaultShow = _this$props7.defaultShow,
1151
+ placement = _this$props7.placement,
1152
+ withArrow = _this$props7.withArrow,
1153
+ shouldContainFocus = _this$props7.shouldContainFocus,
1154
+ shouldReturnFocus = _this$props7.shouldReturnFocus,
1155
+ trigger = _this$props7.trigger,
1156
+ mountNode = _this$props7.mountNode,
1157
+ constrain = _this$props7.constrain,
1158
+ positionTarget = _this$props7.positionTarget,
1159
+ positionContainerDisplay = _this$props7.positionContainerDisplay,
1160
+ popoverRef = _this$props7.popoverRef,
1161
+ disabled = _this$props7.disabled,
1162
+ onDismiss = _this$props7.onDismiss,
1163
+ onFocus = _this$props7.onFocus,
1164
+ onMouseOver = _this$props7.onMouseOver,
1165
+ offsetX = _this$props7.offsetX,
1166
+ offsetY = _this$props7.offsetY;
1154
1167
  return trigger ? (0, _jsxRuntime.jsx)(_Popover.Popover, {
1155
1168
  isShowingContent: show,
1156
1169
  defaultIsShowingContent: defaultShow,
@@ -1165,7 +1178,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
1165
1178
  this.handleToggle(event, false);
1166
1179
  },
1167
1180
  onShowContent: event => this.handleToggle(event, true),
1168
- mountNode: mountNode,
1181
+ mountNode: mountNode || this.ref,
1169
1182
  placement: placement,
1170
1183
  withArrow: withArrow,
1171
1184
  positionTarget: positionTarget,
@@ -1179,6 +1192,15 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
1179
1192
  onMouseOver: onMouseOver,
1180
1193
  offsetX: offsetX,
1181
1194
  offsetY: offsetY,
1195
+ defaultFocusElement: () => {
1196
+ var _this$currentPage$chi2, _this$_popover2, _this$_popover2$_cont;
1197
+ if (!this.currentPage) return null;
1198
+ const actionLabel = (0, _callRenderProp.callRenderProp)(this.currentPage.renderActionLabel);
1199
+ // Use action ID if exists, otherwise first non-action option's ID
1200
+ const targetId = actionLabel ? this._headerActionId : (_this$currentPage$chi2 = this.currentPage.children[0]) === null || _this$currentPage$chi2 === void 0 ? void 0 : _this$currentPage$chi2.props.id;
1201
+ if (!targetId) return null;
1202
+ return (_this$_popover2 = this._popover) === null || _this$_popover2 === void 0 ? void 0 : (_this$_popover2$_cont = _this$_popover2._contentElement) === null || _this$_popover2$_cont === void 0 ? void 0 : _this$_popover2$_cont.querySelector(`#${targetId}`);
1203
+ },
1182
1204
  elementRef: element => {
1183
1205
  // setting ref for "Popover" version, the popover root
1184
1206
  // (if there is no trigger, we set it in handleDrilldownRef)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-drilldown",
3
- "version": "10.18.1-snapshot-5",
3
+ "version": "10.18.1-snapshot-7",
4
4
  "description": "A drilldown menu component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,29 +24,29 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.26.0",
27
- "@instructure/console": "10.18.1-snapshot-5",
28
- "@instructure/emotion": "10.18.1-snapshot-5",
29
- "@instructure/shared-types": "10.18.1-snapshot-5",
30
- "@instructure/ui-dom-utils": "10.18.1-snapshot-5",
31
- "@instructure/ui-icons": "10.18.1-snapshot-5",
32
- "@instructure/ui-options": "10.18.1-snapshot-5",
33
- "@instructure/ui-popover": "10.18.1-snapshot-5",
34
- "@instructure/ui-position": "10.18.1-snapshot-5",
35
- "@instructure/ui-prop-types": "10.18.1-snapshot-5",
36
- "@instructure/ui-react-utils": "10.18.1-snapshot-5",
37
- "@instructure/ui-selectable": "10.18.1-snapshot-5",
38
- "@instructure/ui-testable": "10.18.1-snapshot-5",
39
- "@instructure/ui-utils": "10.18.1-snapshot-5",
40
- "@instructure/ui-view": "10.18.1-snapshot-5",
27
+ "@instructure/console": "10.18.1-snapshot-7",
28
+ "@instructure/emotion": "10.18.1-snapshot-7",
29
+ "@instructure/shared-types": "10.18.1-snapshot-7",
30
+ "@instructure/ui-dom-utils": "10.18.1-snapshot-7",
31
+ "@instructure/ui-icons": "10.18.1-snapshot-7",
32
+ "@instructure/ui-options": "10.18.1-snapshot-7",
33
+ "@instructure/ui-popover": "10.18.1-snapshot-7",
34
+ "@instructure/ui-position": "10.18.1-snapshot-7",
35
+ "@instructure/ui-prop-types": "10.18.1-snapshot-7",
36
+ "@instructure/ui-react-utils": "10.18.1-snapshot-7",
37
+ "@instructure/ui-selectable": "10.18.1-snapshot-7",
38
+ "@instructure/ui-testable": "10.18.1-snapshot-7",
39
+ "@instructure/ui-utils": "10.18.1-snapshot-7",
40
+ "@instructure/ui-view": "10.18.1-snapshot-7",
41
41
  "prop-types": "^15.8.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@instructure/ui-axe-check": "10.18.1-snapshot-5",
45
- "@instructure/ui-babel-preset": "10.18.1-snapshot-5",
46
- "@instructure/ui-color-utils": "10.18.1-snapshot-5",
47
- "@instructure/ui-scripts": "10.18.1-snapshot-5",
48
- "@instructure/ui-test-utils": "10.18.1-snapshot-5",
49
- "@instructure/ui-themes": "10.18.1-snapshot-5",
44
+ "@instructure/ui-axe-check": "10.18.1-snapshot-7",
45
+ "@instructure/ui-babel-preset": "10.18.1-snapshot-7",
46
+ "@instructure/ui-color-utils": "10.18.1-snapshot-7",
47
+ "@instructure/ui-scripts": "10.18.1-snapshot-7",
48
+ "@instructure/ui-test-utils": "10.18.1-snapshot-7",
49
+ "@instructure/ui-themes": "10.18.1-snapshot-7",
50
50
  "@testing-library/jest-dom": "^6.6.3",
51
51
  "@testing-library/react": "^16.0.1",
52
52
  "@testing-library/user-event": "^14.5.2",
@@ -887,8 +887,20 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
887
887
  }
888
888
 
889
889
  handleToggle = (event: React.UIEvent | React.FocusEvent, shown: boolean) => {
890
- const { onToggle } = this.props
891
-
890
+ const { onToggle, trigger } = this.props
891
+
892
+ if (trigger && shown && this.currentPage) {
893
+ const actionLabel = callRenderProp(this.currentPage.renderActionLabel)
894
+ // Use action ID if exists, otherwise first non-action option's ID
895
+ const targetId = actionLabel
896
+ ? this._headerActionId
897
+ : this.currentPage.children[0]?.props.id
898
+ setTimeout(() => {
899
+ this.setState({
900
+ highlightedOptionId: targetId
901
+ })
902
+ }, 10)
903
+ }
892
904
  this.setState({ isShowingPopover: shown })
893
905
 
894
906
  if (typeof onToggle === 'function') {
@@ -1481,7 +1493,7 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
1481
1493
  this.handleToggle(event, false)
1482
1494
  }}
1483
1495
  onShowContent={(event) => this.handleToggle(event, true)}
1484
- mountNode={mountNode}
1496
+ mountNode={mountNode || this.ref}
1485
1497
  placement={placement}
1486
1498
  withArrow={withArrow}
1487
1499
  positionTarget={positionTarget}
@@ -1495,6 +1507,17 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
1495
1507
  onMouseOver={onMouseOver}
1496
1508
  offsetX={offsetX}
1497
1509
  offsetY={offsetY}
1510
+ defaultFocusElement={() => {
1511
+ if (!this.currentPage) return null
1512
+ const actionLabel = callRenderProp(this.currentPage.renderActionLabel)
1513
+ // Use action ID if exists, otherwise first non-action option's ID
1514
+ const targetId = actionLabel
1515
+ ? this._headerActionId
1516
+ : this.currentPage.children[0]?.props.id
1517
+
1518
+ if (!targetId) return null
1519
+ return this._popover?._contentElement?.querySelector(`#${targetId}`)
1520
+ }}
1498
1521
  elementRef={(element) => {
1499
1522
  // setting ref for "Popover" version, the popover root
1500
1523
  // (if there is no trigger, we set it in handleDrilldownRef)
@@ -207,7 +207,7 @@ type DrilldownOwnProps = {
207
207
 
208
208
  /**
209
209
  * If a trigger is supplied, an element or a function returning an element
210
- * to use as the mount node for the `<Drilldown />` (defaults to `document.body`)
210
+ * to use as the mount node for the `<Drilldown />` (defaults to the component itself)
211
211
  */
212
212
  mountNode?: PositionMountNode
213
213