bito-code-review[bot] commented on PR #40297:
URL: https://github.com/apache/superset/pull/40297#issuecomment-4502680147
<!-- Bito Reply -->
The PR diff shows that the `getSelectPopupContainer` function was added to
handle popup container logic based on `appSection` and `showOverflow`. The
function ensures that for dashboard and filter bar sections, the popup is
mounted to `document.body` when not overflowing, and to the parent node
otherwise. The test cases added validate this behavior. To resolve the issue,
the `appSection` should be propagated from the native filter bar into
`SuperChart` with `appSection={AppSection.Dashboard}` or `AppSection.FilterBar`
in `FilterValue.tsx`. This will ensure the correct container is used for the
dropdowns.
**superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx**
```
export const getSelectPopupContainer = (
appSection: AppSection,
showOverflow: boolean,
parentRef?: RefObject<any>,
) => {
if (showOverflow) {
return () => (parentRef?.current as HTMLElement) || document.body;
}
if (
appSection === AppSection.Dashboard ||
appSection === AppSection.FilterBar
) {
return () => document.body;
}
return (trigger: HTMLElement) =>
(trigger?.parentNode as HTMLElement) || document.body;
};
```
**superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx**
```
test('uses document.body as popup container in dashboard filter bar', () => {
const container = getSelectPopupContainer(AppSection.Dashboard, false);
expect(container(document.createElement('div'))).toBe(document.body);
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]