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

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,
@@ -4322,6 +4323,17 @@ var Combobox = React.forwardRef(function (_a, ref) {
4322
4323
  return value === lastSelectedValue;
4323
4324
  }) || [], 2), element = _a[0], option = _a[1];
4324
4325
  if (autocomplete === 'manual') {
4326
+ // In multiselect, the listbox manages its own active option via
4327
+ // keyboard navigation. When the last-selected value no longer
4328
+ // matches any option (e.g. after deselecting the only selected
4329
+ // option), preserve the existing active descendant so the next
4330
+ // Enter keypress can re-toggle the highlighted option.
4331
+ if (multiselect &&
4332
+ !element &&
4333
+ activeDescendant &&
4334
+ matchingOptions.has(activeDescendant.element)) {
4335
+ return;
4336
+ }
4325
4337
  setActiveDescendant(!element ? null : tslib.__assign({ element: element }, option));
4326
4338
  }
4327
4339
  else if (autocomplete === 'automatic' &&
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.c367e9d4",
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",