Skip to content

Commit

Permalink
Merge branch 'main' into use-overflow-items
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmenendez committed Dec 27, 2024
2 parents c325bba + d341b15 commit 05a7abd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';

import * as stories from './SidePanel';
import * as stories from './SidePanel.stories';

const DocsPage = () => (
<StoryDocsPage
Expand Down
34 changes: 16 additions & 18 deletions packages/ibm-products/src/components/SidePanel/SidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export let SidePanel = React.forwardRef(
if (!open) {
onUnmount?.();
}
setAnimationComplete(true);
setAnimationComplete(!animationComplete);
};

// Set the internal state `animationComplete` to true if
Expand Down Expand Up @@ -631,26 +631,24 @@ export let SidePanel = React.forwardRef(
]);

useEffect(() => {
if (open) {
setTimeout(() => {
if (open && animationComplete) {
if (
selectorPrimaryFocus &&
getSpecificElement(sidePanelRef?.current, selectorPrimaryFocus)
) {
const primeFocusEl = getSpecificElement(
sidePanelRef?.current,
selectorPrimaryFocus
);
if (
selectorPrimaryFocus &&
getSpecificElement(sidePanelRef?.current, selectorPrimaryFocus)
primeFocusEl &&
window?.getComputedStyle(primeFocusEl)?.display !== 'none'
) {
const primeFocusEl = getSpecificElement(
sidePanelRef?.current,
selectorPrimaryFocus
);
if (
primeFocusEl &&
window?.getComputedStyle(primeFocusEl)?.display !== 'none'
) {
(primeFocusEl as HTMLElement)?.focus();
}
} else if (!slideIn) {
firstElement?.focus();
setTimeout(() => primeFocusEl?.focus(), 0);
}
}, 0);
} else if (!slideIn) {
setTimeout(() => firstElement?.focus(), 0);
}
}
}, [
animationComplete,
Expand Down
4 changes: 4 additions & 0 deletions packages/ibm-products/telemetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,17 @@ collect:
- editButtonText
- editing
- editSuccess
- editSuccessMessage
- editSuccessTitle
- errorText
- generateButtonText
- generateSuccessBody
- generateSuccessMessage
- generateSuccessTitle
- generateTitle
- hasAPIKeyVisibilityToggle
- hasDownloadLink
- helperText
- hideAPIKeyLabel
- loadingText
- modalLabel
Expand Down Expand Up @@ -532,6 +535,7 @@ collect:
- fixedIsVisible
# CoachmarkOverlayElements
- isVisible
- onBack
# CoachmarkStackHome
- onClickNavItem
# Columns
Expand Down

0 comments on commit 05a7abd

Please sign in to comment.