Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix console errors in inspector #156894

Merged
merged 12 commits into from
May 15, 2023
16 changes: 3 additions & 13 deletions packages/core/overlays/core-overlays-browser/src/flyout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { EuiFlyoutSize, EuiOverlayMaskProps } from '@elastic/eui';
import type { EuiFlyoutProps } from '@elastic/eui';
import type { MountPoint, OverlayRef } from '@kbn/core-mount-utils-browser';

/**
Expand All @@ -28,20 +28,10 @@ export interface OverlayFlyoutStart {
/**
* @public
*/
export interface OverlayFlyoutOpenOptions {
className?: string;
closeButtonAriaLabel?: string;
ownFocus?: boolean;
'data-test-subj'?: string;
'aria-label'?: string;
size?: EuiFlyoutSize;
maxWidth?: boolean | number | string;
hideCloseButton?: boolean;
outsideClickCloses?: boolean;
maskProps?: EuiOverlayMaskProps;
export type OverlayFlyoutOpenOptions = Omit<EuiFlyoutProps, 'onClose'> & {
/**
* EuiFlyout onClose handler.
* If provided the consumer is responsible for calling flyout.close() to close the flyout;
*/
onClose?: (flyout: OverlayRef) => void;
}
};
2 changes: 1 addition & 1 deletion src/plugins/inspector/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class InspectorPublicPlugin implements Plugin<Setup, Start> {
),
{
'data-test-subj': 'inspectorPanel',
closeButtonAriaLabel: closeButtonLabel,
closeButtonProps: { 'aria-label': closeButtonLabel },
}
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ test('passes through flyout options when opening flyout', () => {

overlays.openFlyout(<>foo</>, {
'data-test-subj': 'foo',
closeButtonAriaLabel: 'bar',
closeButtonProps: { 'aria-label': 'bar' },
});

expect(coreOverlays.openFlyout.mock.calls[0][1]).toEqual({
'data-test-subj': 'foo',
closeButtonAriaLabel: 'bar',
closeButtonProps: { 'aria-label': 'bar' },
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function showCategorizeFlyout(
{
'data-test-subj': 'aiopsCategorizeFlyout',
ownFocus: true,
closeButtonAriaLabel: 'aiopsCategorizeFlyout',
closeButtonProps: { 'aria-label': 'aiopsCategorizeFlyout' },
onClose: onFlyoutClose,
size: 'l',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => {
),
{
size: 'm',
closeButtonAriaLabel: i18n.translate('xpack.graph.settings.closeLabel', {
defaultMessage: 'Close',
}),
closeButtonProps: {
'aria-label': i18n.translate('xpack.graph.settings.closeLabel', {
defaultMessage: 'Close',
}),
},
'data-test-subj': 'graphSettingsFlyout',
ownFocus: true,
className: 'gphSettingsFlyout',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function resolveJobSelection(
{
'data-test-subj': 'mlFlyoutJobSelector',
ownFocus: true,
closeButtonAriaLabel: 'jobSelectorFlyout',
closeButtonProps: { 'aria-label': 'jobSelectorFlyout' },
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export function createFlyout(
'data-test-subj': 'mlFlyoutLayerSelector',
ownFocus: true,
onClose: onFlyoutClose,
// @ts-expect-error should take any number/string compatible with the CSS width attribute
size: '35vw',
}
);
Expand Down