-
Notifications
You must be signed in to change notification settings - Fork 90
feat(lightspeed): Add Escape key to cycle through display modes #2182
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
base: main
Are you sure you want to change the base?
feat(lightspeed): Add Escape key to cycle through display modes #2182
Conversation
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
Changed Packages
|
HusneShabbir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've observed a deviation where using the keyboard's Escape key to exit the chat actions menu impacts the Lightspeed display mode. This issue occurs most of the time and is reproducible. Please find the attached recording for reference.
Screen.Recording.2026-01-27.at.11.53.54.PM.mov
HusneShabbir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aprilma419 what’s your take on the above observation?
|
@HusneShabbir looks good, didn't see any issues so far IMO |
karthikjeeyar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! I have a suggestion on finding the open modals, PTAL
| // Check if any modal dialog is currently visible (Delete, Rename, etc.) | ||
| const hasOpenModal = document.querySelector('.MuiDialog-root'); | ||
|
|
||
| // If settings dropdown or modal is open, let those handle Escape first | ||
| if (isSettingsDropdownOpen || hasOpenModal) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a brittle implementation and could break if MUI class names are changed or if we start using BUI instead of MUI.
const hasOpenModal = document.querySelector('.MuiDialog-root');
| isSettingsDropdownOpen: boolean; | ||
| /** | ||
| * Setter for settings dropdown open state | ||
| */ | ||
| setIsSettingsDropdownOpen: (isOpen: boolean) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is related to my previous comment.
Can you use similar approach to track if the rename/delete/attachment modals are open so that you can use that information to see if any modals are open, rather than relying on className .MuiDialog-root ?
pseudo code:
const [openModals, setOpenModals] = useState<Set<string>>(new Set());
const openModal = useCallback((modalId: string) => {
setOpenModals(prev => new Set(prev).add(modalId));
}, []);
const closeModal = useCallback((modalId: string) => {
setOpenModals(prev => {
const next = new Set(prev);
next.delete(modalId);
return next;
});
Then context can expose method and properties like openModal, closeModal, hasOpenModals etc, so that you can use this to decide whether to perform any action or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code can become complex, see my latest comment below, we dont need to maintain modalIds instead we can have a simple boolean to track if there any nestedModals Open and based on that we can avoid closing the main chatbot.
|
|
Is this a new feature pressing escape to cycle through display mode? I can see this works only once, if you again go to the fullscreen for the second round and pressing escape does nothing, is this expected? More over I can still reproduce the issue outlined in this https://issues.redhat.com/browse/RHDHBUGS-2490 ticket. If I open a rename modal (from overlay mode) and press Escape it is closing the chatbot. |
|
I had taken a closer look at the code changes. When Escape is pressed on nested modals (DeleteModal, Rename, Attachment Modals etc), the event bubbles to the parent ChatbotModal, causing I would expect closeChatbot should early return the escape events when any of the modals are open. IMO we should not mix feature and bug fix in a PR as this could become problematic especially when you want to backport a fix to earlier backstage version, I would keep create two PRs one for bug fix and one for the display cycle feature (if we want this). |
|
I agree with @karthikjeeyar. Let’s avoid over-complicating the Esc key behavior. Since display mode selection is now persisted, cycling through display modes on Esc would unnecessarily complicate that logic. Instead, pressing Esc should first close any open modal or the Lightspeed settings dropdown; pressing it again should close the chatbot cc @aprilma419 |




Description
UI after changes
Screen.Recording.2026-01-27.at.10.42.18.PM.mov
Fixes
✔️ Checklist