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.

Chatbot

Chatbot in fullscreen

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

Issue fork ai-3518356

Command icon 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

bbruno created an issue. See original summary.

bbruno’s picture

We have worked on this at 1xINTERNET and would want to share our work

mrdalesmith’s picture

Hi @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

kristen pol’s picture

Title: Extend current ChatBot overlay (modal) functionality » Extend current AI ChatBot overlay (modal) functionality
Component: Other Submodules » AI Chatbot

We 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.

bbruno’s picture

Title: Extend current AI ChatBot overlay (modal) functionality » Add Full screen and Expand options to Deepchat chatbot
Version: 1.1.x-dev » 1.2.x-dev
Issue summary: View changes
StatusFileSize
new344.63 KB
new259.96 KB

rajeshreeputra made their first commit to this issue’s fork.

venkatesh rajan.j’s picture

Hi @bbruno, your work looks interesting. Please add your changes here.

marcus_johansson’s picture

Version: 1.2.x-dev » 2.0.x-dev
unqunq’s picture

StatusFileSize
new197.79 KB

Maybe 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.

noicon

marcus_johansson’s picture

Issue tags: +priority
marcus_johansson’s picture

Issue tags: +AI Initiative Sprint
arianraeesi’s picture

Issue tags: +AI Product Development

bbruno’s picture

Assigned: bbruno » Unassigned
Status: Active » Needs review
StatusFileSize
new43.11 KB
new5.02 MB
new4.67 MB

I 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.

Ui interface

Here is what they look like:

Expand

Ui interface

Fullscreen

Ui interface

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!

petar_basic’s picture

Assigned: Unassigned » petar_basic
petar_basic’s picture

Assigned: petar_basic » Unassigned
Status: Needs review » Needs work

Thank 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.

bbruno’s picture

Thanks for the comments and suggestions! I'll take a look here soon.

bbruno’s picture

Assigned: Unassigned » bbruno
bbruno’s picture

Assigned: bbruno » Unassigned
Status: Needs work » Needs review

I have taken a look at the comments provided and updated the MR.

Back up for review, thanks!

ahmad khader’s picture

Assigned: Unassigned » ahmad khader
ahmad khader’s picture

Status: Needs review » Needs work

Thank you @bbruno, the approach of offering configurable expansion methods (none/expand/fullscreen) as a block setting is clean and flexible.

Testing Environment

  • Drupal 11.3, AI module 1.3.x-dev
  • Gin admin theme, toolbar placement
  • Tested all three expansion_method options: none, expand, fullscreen

What Works Well

  • Overall functionality: The expand and fullscreen features work as expected, providing a flexible and user-friendly experience.
  • Conditional library loading: toolbar-fullscreen.css is only attached when expansion_method == 'fullscreen' — verified via non-aggregated CSS output. Clean separation of concerns.
  • Block form UX: The #states visibility condition correctly hides the "Expansion method" field for non-toolbar placements.
  • Fullscreen exit animation: The animationend + double requestAnimationFrame approach for clean exit transitions is solid.
  • Accessibility: aria-expanded toggling and Escape key handler for fullscreen are good.
  • Schema: expansion_method is properly added to the block settings schema.
  • CSS architecture: Using a CSS custom property (--toolbar-chatbot-expand-amount) to drive width calculations is elegant — it allows the expand amount to propagate through all dependent calculations without duplication.
  • Mode: "none": When set to 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.js call toggleChatbot(false), but toggleChatbot is defined as const toggleChatbot = () => { ... } — it takes no parameters. The false argument 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:

  • Accepting an optional parameter: const toggleChatbot = (forceClose = null) => { ... }
  • Or simply calling toggleChatbot() without the misleading argument

2. Expand state not cleaned up on close

In expand mode: When the user expands the chatbot (adds ai-chatbot-expanded to body) and then clicks the close button (lines 97-104), the ai-chatbot-expanded class and the expand button's active class are not removed. So reopening the chatbot shows it already expanded. This is the opposite behavior from fullscreen mode, where exitFullscreen() 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-expanded attribute will be stale (still "true" on a closed chatbot). Consider either:

  • Resetting expand state on close (consistent with fullscreen)
  • Or documenting this as intentional and persisting via localStorage (consistent with the chatbotOpened state)

3. Trailing whitespace (nitpick)

toolbar-chatbot.js line 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.svg uses stroke="#414247" (hardcoded color) while other SVGs use currentColor. Since these are all used as mask-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.

ahmad khader’s picture

Assigned: ahmad khader » Unassigned
bbruno’s picture

Assigned: Unassigned » bbruno
bbruno’s picture

Assigned: bbruno » Unassigned
Status: Needs work » Needs review

@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

petar_basic’s picture

Assigned: Unassigned » petar_basic
petar_basic’s picture

Status: Needs review » Reviewed & tested by the community

Re-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.

petar_basic’s picture

Assigned: petar_basic » Unassigned
marcus_johansson’s picture

@bbruno, is there some reason this can not be backported to 1.3.x?

bbruno’s picture

@marcus_johansson nope, it should be possible

davidbp made their first commit to this issue’s fork.

  • a.dmitriiev committed 15454aa9 on 2.0.x authored by bbruno
    #3518356: add fullscreen and expansion option to toolbar chatbot
    
a.dmitriiev’s picture

Status: Reviewed & tested by the community » Fixed

Merged

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

arianraeesi’s picture

Issue tags: -AI Product Development

marcus_johansson’s picture

Tested for 1.3.x as well and being backported.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.