From 4fe74d9b8aaff0ffdf03485dce747a42301f288c Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Wed, 27 Aug 2025 18:49:13 +0300 Subject: [PATCH] fix: [Analytics:Visualize Library: Create page]Missing state change announcement for switch button (#232983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: #215327 **Description** When activating an element, users should receive a clear state-change announcement so they understand it has been successfully activated. **Changes Made** For accessibility reasons, the modal dialog is no longer closed automatically after the "Auto-apply visualization changes" action. - This effectively reverts the changes introduced in #141272. **Notes for Reviewers** - I tested the scenario mentioned in [this comment](https://github.com/elastic/kibana/issues/141203#issuecomment-1253509012). - The behavior described there is no longer relevant, so we don’t need to preserve that workaround. **Screen** https://github.com/user-attachments/assets/69eef4ed-2426-449e-a872-8ed38f89303d (cherry picked from commit c329b83d75b5a9acab2924705b00e7a8e99381e9) --- .../lens/public/app_plugin/settings_menu.test.tsx | 13 +------------ .../shared/lens/public/app_plugin/settings_menu.tsx | 3 +-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.test.tsx b/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.test.tsx index ab15ebd5a47c7..f867e6093c847 100644 --- a/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.test.tsx +++ b/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { renderWithReduxStore } from '../mocks'; import { SettingsMenu } from './settings_menu'; -import { screen, waitFor } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; describe('settings menu', () => { @@ -41,17 +41,6 @@ describe('settings menu', () => { }; }; - afterEach(() => { - onCloseMock.mockClear(); - }); - - it('should call onClose when popover closes after toggling', async () => { - const { toggleAutoApply } = renderSettingsMenu(); - await toggleAutoApply(); - - await waitFor(() => expect(onCloseMock).toHaveBeenCalledTimes(1)); - }); - it('should toggle auto-apply', async () => { const { toggleAutoApply, isAutoApplyOn } = renderSettingsMenu(); diff --git a/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.tsx b/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.tsx index 09eb90be2c3c7..4f6cd8af6f15b 100644 --- a/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.tsx +++ b/x-pack/platform/plugins/shared/lens/public/app_plugin/settings_menu.tsx @@ -44,14 +44,13 @@ export function SettingsMenu({ const dispatch = useLensDispatch(); const toggleAutoApply = useCallback(() => { - onClose(); writeToStorage( new Storage(localStorage), AUTO_APPLY_DISABLED_STORAGE_KEY, String(autoApplyEnabled) ); dispatch(autoApplyEnabled ? disableAutoApply() : enableAutoApply()); - }, [dispatch, autoApplyEnabled, onClose]); + }, [dispatch, autoApplyEnabled]); return (