Merge pull request #9121 from Sarabadu/fix-popover-focus
removes `ignoreChildEvent`utility
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/core-components': patch
|
||||
---
|
||||
|
||||
Remove the `ignoreChildEvent` utility from the sidebar component to avoid conflicts with popovers
|
||||
@@ -182,13 +182,9 @@ const DesktopSidebar = (props: SidebarProps) => {
|
||||
className={classes.root}
|
||||
data-testid="sidebar-root"
|
||||
onMouseEnter={disableExpandOnHover ? () => {} : handleOpen}
|
||||
onFocus={
|
||||
disableExpandOnHover ? () => {} : ignoreChildEvent(handleOpen)
|
||||
}
|
||||
onFocus={disableExpandOnHover ? () => {} : handleOpen}
|
||||
onMouseLeave={disableExpandOnHover ? () => {} : handleClose}
|
||||
onBlur={
|
||||
disableExpandOnHover ? () => {} : ignoreChildEvent(handleClose)
|
||||
}
|
||||
onBlur={disableExpandOnHover ? () => {} : handleClose}
|
||||
>
|
||||
<div
|
||||
className={classnames(classes.drawer, {
|
||||
@@ -242,13 +238,3 @@ function A11ySkipSidebar() {
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
function ignoreChildEvent(handlerFn: (e?: any) => void) {
|
||||
// TODO type the event
|
||||
return (event: any) => {
|
||||
const currentTarget = event?.currentTarget as HTMLElement;
|
||||
if (!currentTarget?.contains(event.relatedTarget as HTMLElement)) {
|
||||
handlerFn(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user