[8.8] fix console errors in inspector (#156894) (#157748)

# Backport

This will backport the following commits from `main` to `8.8`:
- [fix console errors in inspector
(#156894)](https://github.com/elastic/kibana/pull/156894)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2023-05-15T15:02:27Z","message":"fix
console errors in inspector (#156894)\n\nSteps to view problem\r\n*
install sample data set\r\n* Open lens visualization\r\n* Open
inspector. Notice console errors\r\n<img width=\"300\" alt=\"Screen Shot
2023-05-05 at 11 03 25
AM\"\r\nsrc=\"https://user-images.githubusercontent.com/373691/236521366-d8fb9302-e93b-4047-a0bf-d7c09dcc3ffb.png\">\r\n\r\nhttps://github.com/elastic/eui/pull/6566
removed `closeButtonAriaLabel`\r\nprop from
[EuiFlyout](https://elastic.github.io/eui/#/layout/flyout) EUI\r\n75.0.0
(Effecting 8.8 and 8.9). FlyoutService spreads options
into\r\n`EuiFlyout`, resulting in `closeButtonAriaLabel` getting added
to dom\r\nand causing error.\r\n\r\n`OverlayFlyoutOpenOptions` type
added by\r\nhttps://github.com/elastic/kibana/issues/37894. I
replaced\r\n`OverlayFlyoutOpenOptions` with `EuiFlyoutProps` to make it
more clear\r\nwhat props are accepted and provide stronger typing that
stays in sync\r\nwith EUI
typings\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b803ba9d7b69250d8bfb0567919128f954c1e935","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Inspector","Team:Presentation","release_note:skip","v8.8.0","v8.9.0"],"number":156894,"url":"https://github.com/elastic/kibana/pull/156894","mergeCommit":{"message":"fix
console errors in inspector (#156894)\n\nSteps to view problem\r\n*
install sample data set\r\n* Open lens visualization\r\n* Open
inspector. Notice console errors\r\n<img width=\"300\" alt=\"Screen Shot
2023-05-05 at 11 03 25
AM\"\r\nsrc=\"https://user-images.githubusercontent.com/373691/236521366-d8fb9302-e93b-4047-a0bf-d7c09dcc3ffb.png\">\r\n\r\nhttps://github.com/elastic/eui/pull/6566
removed `closeButtonAriaLabel`\r\nprop from
[EuiFlyout](https://elastic.github.io/eui/#/layout/flyout) EUI\r\n75.0.0
(Effecting 8.8 and 8.9). FlyoutService spreads options
into\r\n`EuiFlyout`, resulting in `closeButtonAriaLabel` getting added
to dom\r\nand causing error.\r\n\r\n`OverlayFlyoutOpenOptions` type
added by\r\nhttps://github.com/elastic/kibana/issues/37894. I
replaced\r\n`OverlayFlyoutOpenOptions` with `EuiFlyoutProps` to make it
more clear\r\nwhat props are accepted and provide stronger typing that
stays in sync\r\nwith EUI
typings\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b803ba9d7b69250d8bfb0567919128f954c1e935"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156894","number":156894,"mergeCommit":{"message":"fix
console errors in inspector (#156894)\n\nSteps to view problem\r\n*
install sample data set\r\n* Open lens visualization\r\n* Open
inspector. Notice console errors\r\n<img width=\"300\" alt=\"Screen Shot
2023-05-05 at 11 03 25
AM\"\r\nsrc=\"https://user-images.githubusercontent.com/373691/236521366-d8fb9302-e93b-4047-a0bf-d7c09dcc3ffb.png\">\r\n\r\nhttps://github.com/elastic/eui/pull/6566
removed `closeButtonAriaLabel`\r\nprop from
[EuiFlyout](https://elastic.github.io/eui/#/layout/flyout) EUI\r\n75.0.0
(Effecting 8.8 and 8.9). FlyoutService spreads options
into\r\n`EuiFlyout`, resulting in `closeButtonAriaLabel` getting added
to dom\r\nand causing error.\r\n\r\n`OverlayFlyoutOpenOptions` type
added by\r\nhttps://github.com/elastic/kibana/issues/37894. I
replaced\r\n`OverlayFlyoutOpenOptions` with `EuiFlyoutProps` to make it
more clear\r\nwhat props are accepted and provide stronger typing that
stays in sync\r\nwith EUI
typings\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b803ba9d7b69250d8bfb0567919128f954c1e935"}}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
This commit is contained in:
Kibana Machine 2023-05-15 12:16:17 -04:00 committed by GitHub
parent 42593d86f4
commit 7a623a822f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 22 deletions

View file

@ -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';
/**
@ -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;
}
};

View file

@ -111,7 +111,7 @@ export class InspectorPublicPlugin implements Plugin<Setup, Start> {
),
{
'data-test-subj': 'inspectorPanel',
closeButtonAriaLabel: closeButtonLabel,
closeButtonProps: { 'aria-label': closeButtonLabel },
}
);
};

View file

@ -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' },
});
});

View file

@ -85,7 +85,7 @@ export async function showCategorizeFlyout(
{
'data-test-subj': 'aiopsCategorizeFlyout',
ownFocus: true,
closeButtonAriaLabel: 'aiopsCategorizeFlyout',
closeButtonProps: { 'aria-label': 'aiopsCategorizeFlyout' },
onClose: onFlyoutClose,
size: 'l',
}

View file

@ -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',

View file

@ -92,7 +92,7 @@ export async function resolveJobSelection(
{
'data-test-subj': 'mlFlyoutJobSelector',
ownFocus: true,
closeButtonAriaLabel: 'jobSelectorFlyout',
closeButtonProps: { 'aria-label': 'jobSelectorFlyout' },
}
);

View file

@ -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',
}
);