Problem/Motivation
As part of the efforts to further update the existing 'Deepchat' chatbot, one of the suggested features which has come along with the new design wireframes has been to allow admins/editors to configure different chat expansion options, which would allow the user to increase the size of the chatbot for easier readability/usability due to the current limited space in its default sidebar positioning.
It is currently depending on the completion of this issue: https://www.drupal.org/project/ai/issues/3531279
So far the 2 suggestions (which could be individually enabled/disabled in the block settings) would be:
- Full Screen mode: Opens the chat in a 'Modal' allowing for full focus and space to chat with the chatbot
- Expand mode: Increases the width of the sidebar chatbot, pushing the rest of the website further to the right.


Proposed resolution
- Implement 2 new options in the AI Chatbot block settings, allowing an editor to choose between different expansion methods, or both.
- Implement functionality in the new Deepchat implementation once available
User interface changes
- 2 new boolean fields for choosing the Chatbot's Expansion methods
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | fullscreen.gif | 4.67 MB | bbruno |
| #14 | expand.gif | 5.02 MB | bbruno |
| #14 | settings.png | 43.11 KB | bbruno |
| #9 | Screenshot 2025-12-12 at 23.18.15.png | 197.79 KB | unqunq |
| #5 | chatbot-options.png | 259.96 KB | bbruno |
Issue fork ai-3518356
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bbruno commentedWe have worked on this at 1xINTERNET and would want to share our work
Comment #3
mrdalesmith commentedHi @bbruno - you don't need permission: feel free to create a fork through this ticket and add your suggested changes. If you need help with the process you can use https://www.drupal.org/community/contributor-guide
Comment #4
kristen polWe are doing some issue management housekeeping and adding/removing components.
We are removing the "Other Submodules" component and want people to categorize issues with the best module/submodule component.
Moving this issue to "AI Chatbot".
See #3533272: Update AI module project components for more details.
Comment #5
bbruno commentedComment #7
venkatesh rajan.j commentedHi @bbruno, your work looks interesting. Please add your changes here.
Comment #8
marcus_johansson commentedComment #9
unqunqMaybe I am not testing it right but when I tried to configure the block to be placed in the Toolbar I seem to be missing that option. It's probably removed. Anyway, placed bottom right, the block does not seem to display any visuals for toggling to full screen. Testing with the Gin admin theme.
Comment #10
marcus_johansson commentedComment #11
marcus_johansson commentedComment #12
arianraeesi commentedComment #14
bbruno commentedI have added to the DeepChat block settings a new setting called Expansion method which is available when the Chatbot placement is set to Toolbar. Here you can select between "None", "Expand", and "Fullscreen".
- Expand = Increases the width of the chatbot and pushes the page to the right
- Fullscreen = Restyles the chatbot block as a Modal. Note: This is done purely with CSS, and does not use any modal/dialogs, this is also needed so the chatbot can be kept in its current message / task state.
Here is what they look like:
Expand
Fullscreen
Testing instructions:
Assuming an Assistant has already been created
1. Add/Edit an AI DeepChat Chatbot block
2. Make sure under Styling settings that the Placement/Style is set to Toolbar
3. Toggle between the different Expansion methods, ensure they work as expected according to the Wireframes in the description
I made some assumptions here to get this done, for example in terms of how long the chatbot should grow, how it should look like in its modal state, etc. So I am also putting this up for review to get some feedback and ideas on how it could be different.
Suggestions on improvements welcome!
Comment #15
petar_basic commentedComment #16
petar_basic commentedThank you!
I've tested this as per instructions, and everything seems to work as described.
I've added some comments & suggestions to the MR, mostly minor, but please have a look if it makes sense to add.
Comment #17
bbruno commentedThanks for the comments and suggestions! I'll take a look here soon.
Comment #18
bbruno commentedComment #19
bbruno commentedI have taken a look at the comments provided and updated the MR.
Back up for review, thanks!
Comment #20
ahmad khader commentedComment #21
ahmad khader commentedThank you @bbruno, the approach of offering configurable expansion methods (none/expand/fullscreen) as a block setting is clean and flexible.
Testing Environment
none,expand,fullscreenWhat Works Well
toolbar-fullscreen.cssis only attached whenexpansion_method == 'fullscreen'— verified via non-aggregated CSS output. Clean separation of concerns.#statesvisibility condition correctly hides the "Expansion method" field for non-toolbar placements.animationend+ doublerequestAnimationFrameapproach for clean exit transitions is solid.aria-expandedtoggling and Escape key handler for fullscreen are good.expansion_methodis properly added to the block settings schema.--toolbar-chatbot-expand-amount) to drive width calculations is elegant — it allows the expand amount to propagate through all dependent calculations without duplication.none, the expand button is completely omitted from the DOM (not just hidden), which is the right approach.Issues Found
1.
toggleChatbot(false)— parameter is ignored (minor)Lines 99 and 102 of
toolbar-chatbot.jscalltoggleChatbot(false), buttoggleChatbotis defined asconst toggleChatbot = () => { ... }— it takes no parameters. Thefalseargument is silently ignored. The function always toggles the state, which happens to work correctly here (since close is only clickable when open), but the intent to explicitly "close" is lost. Consider either:const toggleChatbot = (forceClose = null) => { ... }toggleChatbot()without the misleading argument2. Expand state not cleaned up on close
In expand mode: When the user expands the chatbot (adds
ai-chatbot-expandedtobody) and then clicks the close button (lines 97-104), theai-chatbot-expandedclass and the expand button'sactiveclass are not removed. So reopening the chatbot shows it already expanded. This is the opposite behavior from fullscreen mode, whereexitFullscreen()properly cleans everything up before closing.This may be intentional (persist expanded state across open/close), but if so, it's asymmetric with fullscreen behavior and the
aria-expandedattribute will be stale (still"true"on a closed chatbot). Consider either:localStorage(consistent with thechatbotOpenedstate)3. Trailing whitespace (nitpick)
toolbar-chatbot.jsline 112 has trailing whitespace. Also, the twig template line 27 (class="sidebar-header--icon toolbar-button expand") has a trailing space before the closing quote — not harmful but worth a quick cleanup.Observations (non-blocking)
collapse.svgusesstroke="#414247"(hardcoded color) while other SVGs usecurrentColor. Since these are all used asmask-image(where only the alpha channel matters), it's functionally equivalent, but inconsistent. Non-blocking.Setting to Needs work. Nice work overall — the architecture is solid and the feature is well thought out.
Comment #22
ahmad khader commentedComment #23
bbruno commentedComment #24
bbruno commented@ahmad khader Thanks a lot for the in depth review! Very appreciated.
I agree with your points, they have been updated. As for whether the expand mode should persist via localStorage, I also agree, but I think this can be up for discussion in a later issue since it was not initially planned. I will bring it up today in the AI UX/UI meeting.
Back to review
Comment #25
petar_basic commentedComment #26
petar_basic commentedRe-reviewed after the latest updates.
Thank you @bbruno for the quick turnaround on the review feedback — the code is looking solid.
Review:
- Issue summary: Complete
- Scope: Changes are focused on the stated feature — no unrelated modifications.
- Manual testing:
- Tested with Gin theme, toolbar placement.
- Expand mode: Sidebar widens correctly, page content shifts right. Caret icon rotates to indicate expanded state.
- Fullscreen mode: Modal opens with fade animation, backdrop overlay works. Escape key exits fullscreen correctly.
- None mode: Expand button is correctly omitted from the DOM.
- Close behavior: Expand and fullscreen states are properly reset on close now
- toggleChatbot() no longer called with unused false argument
- Coding standards: No issues spotted.
- Accessibility: aria-expanded and aria-label attributes present and update correctly. Escape key handler works for fullscreen.
I would agree about discussing persistance ofthe expand mode in localStorage at a separate issue.
Setting to RTBC.
Comment #27
petar_basic commentedComment #28
marcus_johansson commented@bbruno, is there some reason this can not be backported to 1.3.x?
Comment #29
bbruno commented@marcus_johansson nope, it should be possible
Comment #32
a.dmitriiev commentedMerged
Comment #34
arianraeesi commentedComment #36
marcus_johansson commentedTested for 1.3.x as well and being backported.