albraa911sa-lgtm opened a new pull request, #41052:
URL: https://github.com/apache/superset/pull/41052

   ### SUMMARY
   
   Resolves #40401
   
   The tab rename flow in SQL Lab was using the browser's native `prompt()` 
dialog, which cannot be styled, may be blocked in some environments (e.g. 
embedded deployments), and breaks the visual consistency of the Superset UI.
   
   This PR replaces it with a `StandardModal` containing an `Input` component 
pre-filled with the current tab name, consistent with how other rename/edit 
operations work across the application.
   
   ### BEFORE / AFTER
   
   | Before | After |
   |--------|-------|
   | Native `window.prompt()` dialog | Styled `StandardModal` with `Input` |
   | Cannot be themed | Fully themed with Superset design system |
   | May be blocked in embedded mode | Works in all environments |
   | `// TODO: Replace native prompt` comment | TODO resolved ✅ |
   
   ### CHANGES
   
   **`SqlEditorTabHeader/index.tsx`**
   - Added `useState` for `isRenameModalOpen` and `newTitle`
   - Added `openRenameModal`, `handleRenameConfirm`, `handleRenameCancel` 
handlers
   - Imported `StandardModal` from `src/components/Modal` and `Input` from 
`antd`
   - Replaced `prompt()` call with modal; Save button is disabled when input is 
empty or whitespace-only
   - Removed the `// TODO: Replace native prompt` comment and `// 
eslint-disable-next-line no-alert` suppression
   
   **`SqlEditorTabHeader.test.tsx`**
   - Removed `jest.spyOn(window, 'prompt')` mock
   - Added test for the full modal save flow
   - Added test for modal cancel flow (no action dispatched, modal closes)
   
   ### CHECKLIST
   
   - [x] Added test for save flow via modal
   - [x] Added test for cancel flow
   - [x] `saveDisabled` prevents empty/whitespace-only renames
   - [x] Input pre-filled with current tab name on open
   - [x] `destroyOnClose` resets state between uses
   - [x] `autoFocus` on input for keyboard accessibility
   - [x] `onPressEnter` triggers save (keyboard shortcut parity)


-- 
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]

Reply via email to