@deque/cauldron-react 4.7.0-canary.e34d0aa1 → 4.7.0-canary.f729866a

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.
Files changed (2) hide show
  1. package/lib/index.js +4 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -8368,7 +8368,6 @@ var Tabs = function (_a) {
8368
8368
  var children = _a.children, thin = _a.thin, _b = _a.orientation, orientation = _b === void 0 ? 'horizontal' : _b, _c = _a.initialActiveIndex, initialActiveIndex = _c === void 0 ? 0 : _c, className = _a.className, onChange = _a.onChange, labelProp = tslib.__rest(_a, ["children", "thin", "orientation", "initialActiveIndex", "className", "onChange"]);
8369
8369
  var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
8370
8370
  var tabsRef = React.useRef(null);
8371
- var focusedTabRef = React.useRef(null);
8372
8371
  var tabs = React__default.Children.toArray(children).filter(function (child) { return child.type === Tab; });
8373
8372
  var tabCount = tabs.length;
8374
8373
  var handleClick = function (index) {
@@ -8441,14 +8440,15 @@ var Tabs = function (_a) {
8441
8440
  }, [activeIndex]);
8442
8441
  var config = tslib.__assign((_a = { id: id, className: classNames('Tab', {
8443
8442
  'Tab--active': selected
8444
- }), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.ref = index === activeIndex ? focusedTabRef : null, _a.onClick = function () { return handleClick(index); }, _a), other);
8443
+ }), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.onClick = function () { return handleClick(index); }, _a), other);
8445
8444
  return React__default.cloneElement(child, config);
8446
8445
  });
8447
8446
  useDidUpdate(function () {
8448
8447
  var _a;
8449
- (_a = focusedTabRef.current) === null || _a === void 0 ? void 0 : _a.focus();
8448
+ var activeTab = (_a = tabsRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(':scope > [role="tablist"] > [aria-selected="true"]');
8449
+ activeTab === null || activeTab === void 0 ? void 0 : activeTab.focus();
8450
8450
  if (typeof onChange === 'function') {
8451
- onChange({ activeTabIndex: activeIndex, target: focusedTabRef.current });
8451
+ onChange({ activeTabIndex: activeIndex, target: activeTab });
8452
8452
  }
8453
8453
  }, [activeIndex]);
8454
8454
  return (React__default.createElement("div", { className: classNames('Tabs', className, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.7.0-canary.e34d0aa1",
3
+ "version": "4.7.0-canary.f729866a",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"