@deque/cauldron-react 7.1.0-canary.b7d2a9c6 → 7.1.0-canary.c3383236

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.
@@ -12,6 +12,7 @@ export default class TopBar extends React.Component<MenuBarProps, MenuBarState>
12
12
  thin: boolean;
13
13
  hasTrigger: boolean;
14
14
  };
15
+ private menuBarRef;
15
16
  constructor(props: MenuBarProps);
16
17
  componentDidMount(): void;
17
18
  componentWillUnmount(): void;
package/lib/index.js CHANGED
@@ -672,6 +672,7 @@ var TopBar$1 = /** @class */ (function (_super) {
672
672
  tslib.__extends(TopBar, _super);
673
673
  function TopBar(props) {
674
674
  var _this = _super.call(this, props) || this;
675
+ _this.menuBarRef = React__default["default"].createRef();
675
676
  _this.onResize = function () {
676
677
  var wide = isWide();
677
678
  if (wide === _this.state.wide) {
@@ -720,10 +721,10 @@ var TopBar$1 = /** @class */ (function (_super) {
720
721
  };
721
722
  TopBar.prototype.onKeyDown = function (e) {
722
723
  var key = keyname__default["default"](e.which);
723
- // This is a temporary workaround until have an opportunity to refactor or replace menubar
724
- // see: https://github.com/dequelabs/cauldron/issues/1934
725
- // eslint-disable-next-line react/no-find-dom-node
726
- var menuBarElement = reactDom.findDOMNode(this);
724
+ var menuBarElement = this.menuBarRef.current;
725
+ if (!menuBarElement) {
726
+ return;
727
+ }
727
728
  var menuItems = Array.from(menuBarElement.children);
728
729
  // account for hidden side bar trigger (hamburger)
729
730
  if (this.state.wide && this.props.hasTrigger) {
@@ -750,7 +751,7 @@ var TopBar$1 = /** @class */ (function (_super) {
750
751
  // disabling no-unused-vars to prevent thin/hasTrigger from being passed through to div
751
752
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
752
753
  var _a = this.props, children = _a.children, className = _a.className; _a.thin; _a.hasTrigger; tslib.__rest(_a, ["children", "className", "thin", "hasTrigger"]);
753
- return (React__default["default"].createElement("ul", { role: "menubar", onKeyDown: this.onKeyDown, className: className }, React.Children.map(children, this.renderChild)));
754
+ return (React__default["default"].createElement("ul", { role: "menubar", onKeyDown: this.onKeyDown, className: className, ref: this.menuBarRef }, React.Children.map(children, this.renderChild)));
754
755
  };
755
756
  TopBar.defaultProps = {
756
757
  thin: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "7.1.0-canary.b7d2a9c6",
3
+ "version": "7.1.0-canary.c3383236",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",
@@ -41,7 +41,7 @@
41
41
  "@babel/preset-env": "^7.22.10",
42
42
  "@babel/preset-react": "^7.22.5",
43
43
  "@babel/preset-typescript": "^7.22.5",
44
- "@figma/code-connect": "^1.4.4",
44
+ "@figma/code-connect": "^1.4.5",
45
45
  "@rollup/plugin-commonjs": "^14.0.0",
46
46
  "@rollup/plugin-dynamic-import-vars": "^1.4.2",
47
47
  "@rollup/plugin-typescript": "^11.1.2",