Skip to content

Commit

Permalink
fix: added hasFocus as deprecated prop
Browse files Browse the repository at this point in the history
  • Loading branch information
guidari committed Jan 19, 2024
1 parent 6d133d4 commit bcbb991
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/react/src/components/Notification/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ export interface ActionableNotificationProps
closeOnEscape?: boolean;

/**
* @deprecated use StaticNotification once it's available. Issue #15532
* Specify if focus should be moved to the component when the notification contains actions
*/
hasFocus?: boolean;
Expand Down Expand Up @@ -1104,7 +1105,7 @@ ActionableNotification.propTypes = {
/**
* Specify if focus should be moved to the component when the notification contains actions
*/
hasFocus: PropTypes.bool,
hasFocus: deprecate(PropTypes.bool),

/**
* Specify the close button should be disabled, or not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ Playground.argTypes = {
disable: true,
},
},
hasFocus: {
table: {
disable: true,
},
},
};
Playground.args = {
actionButtonLabel: 'Action',
Expand Down
19 changes: 15 additions & 4 deletions packages/react/src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ function TabList({
const nextButton = useRef<HTMLButtonElement>(null);
const [isScrollable, setIsScrollable] = useState(false);
const [scrollLeft, setScrollLeft] = useState<number>(0);
const [activeTabs, setActiveTabs] = useState<TabElement[]>([]);

let hasSecondaryLabelTabs = false;
if (contained) {
Expand Down Expand Up @@ -398,16 +399,26 @@ function TabList({
}, scrollDebounceWait);
}, [scrollDebounceWait]);

useEffect(() => {
setActiveTabs([]);
console.log('tabs', tabs);
const filteredTabs: TabElement[] = tabs.current.filter(
(tab) => !tab.disabled
);

setActiveTabs(filteredTabs);
// console.log('activeTabs UseEffect', activeTabs);
}, [tabs]);

function onKeyDown(event: KeyboardEvent) {
if (
matches(event, [keys.ArrowRight, keys.ArrowLeft, keys.Home, keys.End])
) {
event.preventDefault();
// filterTabs();
console.log('onKeyDown');

const activeTabs: TabElement[] = tabs.current.filter(
(tab) => !tab.disabled
);

console.log('activeTabs', activeTabs);
const currentIndex = activeTabs.indexOf(
tabs.current[activation === 'automatic' ? selectedIndex : activeIndex]
);
Expand Down

0 comments on commit bcbb991

Please sign in to comment.