Skip to content

refactor(chat)!: rework styling internals for messages#2188

Merged
simeonoff merged 3 commits into
masterfrom
simeonoff/chat-fixes
Apr 16, 2026
Merged

refactor(chat)!: rework styling internals for messages#2188
simeonoff merged 3 commits into
masterfrom
simeonoff/chat-fixes

Conversation

@simeonoff
Copy link
Copy Markdown
Collaborator

@simeonoff simeonoff commented Apr 15, 2026

Depends on IgniteUI/igniteui-theming#566
Closes #2150

Description

Improve the styling of the chat messages via updated properties coming from the latest Ignite UI Theming. This is a breaking change since some of the message-related CSS custom properties have been replaced with specific ones that carry different names.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Breaking change (fix or feature that causes existing functionality to change)
  • Refactoring (code improvements without functional changes)

Testing

Open the chat component sample and try modifying the theme using:

  1. Plain CSS variables
  2. By generating a Sass theme for the Chat Component

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • Breaking changes are documented in the description

Comment thread src/components/chat/themes/shared/chat-message/chat-message.indigo.scss Outdated
…digo.scss

Co-authored-by: Dilyana Yarabanova <45598235+didimmova@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 11:58
@simeonoff simeonoff merged commit 55f1c04 into master Apr 16, 2026
6 checks passed
@simeonoff simeonoff deleted the simeonoff/chat-fixes branch April 16, 2026 12:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the chat message styling to use updated Ignite UI Theming tokens and to differentiate sent vs received messages via separate part names, enabling more granular styling (including corner handling).

Changes:

  • Updates shared chat-message styles to use new theme token keys for sent/received backgrounds and colors.
  • Adds a received part to the message container and introduces a theme-controlled “corner radius” CSS variable (with an indigo override).
  • Removes legacy bootstrap/fluent chat-message theme overrides and trims the per-message base CSS custom properties.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/components/chat/themes/shared/chat-message/chat-message.indigo.scss Adds indigo-specific override for --message-corner-radius.
src/components/chat/themes/shared/chat-message/chat-message.fluent.scss Removes fluent-specific override stylesheet (was effectively unused/commented).
src/components/chat/themes/shared/chat-message/chat-message.common.scss Introduces sent/received token-based styling and shared corner-radius behavior.
src/components/chat/themes/shared/chat-message/chat-message.bootstrap.scss Removes bootstrap-specific override stylesheet.
src/components/chat/themes/message.ts Simplifies theme map to only include the indigo override stylesheet.
src/components/chat/themes/message.base.scss Renames/reshapes message CSS custom properties and adjusts container/sent layout styling.
src/components/chat/chat-message.ts Adds received part assignment for non-current-user messages.

Comment on lines 287 to 291

const parts = {
'message-container': true,
received: !this._state.isCurrentUserMessage(this.message),
sent: this._state.isCurrentUserMessage(this.message),
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isCurrentUserMessage(this.message) is computed twice when building parts. Consider storing the result in a local const isSent = ... and deriving both sent/received from it to avoid duplicate work and keep the logic easier to read.

Suggested change
const parts = {
'message-container': true,
received: !this._state.isCurrentUserMessage(this.message),
sent: this._state.isCurrentUserMessage(this.message),
const isSent = this._state.isCurrentUserMessage(this.message);
const parts = {
'message-container': true,
received: !isSent,
sent: isSent,

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +11
--ig-chat-message-padding-block: #{pad-block(12px)};
--ig-chat-message-padding-inline: #{pad-inline(16px)};
--ig-chat-message-padding: var(--ig-chat-message-padding-block)
var(--ig-chat-message-padding-inline);
--ig-chat-sent-message-start-margin: auto;
--ig-chat-sent-message-end-margin: unset;
--ig-chat-message-container-end-margin: auto;
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New message-level CSS custom properties use the --ig-chat-* prefix, but the rest of the chat component’s public CSS vars use the --igc-chat-* prefix (e.g. --igc-chat-height in chat.base.scss). This looks like an inconsistent/possibly accidental rename that makes the API harder to discover and breaks prefix consistency across components. Consider renaming these to --igc-chat-message-* (and optionally keep the old names as aliases for a deprecation window).

Copilot uses AI. Check for mistakes.
Comment on lines 55 to 60
[part~='sent'] {
margin-inline: var(--igc-chat-sent-message-start-margin, 0) var(--igc-chat-sent-message-end-margin, 0);
padding: var(--igc-chat-message-padding);
border-radius: rem(24px) rem(24px) 0;
margin-inline: var(--ig-chat-sent-message-start-margin, 0)
var(--ig-chat-sent-message-end-margin, 0);
max-width: rem(576px);
width: fit-content;
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

received messages now get a background via chat-message.common.scss, but only [part~='sent'] constrains width (max-width + width: fit-content). As a result, received message containers will likely stretch to the full available width in the column flex layout, producing a full-width background block. Consider moving the width/max-width constraints to [part~='message-container'] (so both variants are constrained) or adding an equivalent rule for [part~='received'].

Copilot uses AI. Check for mistakes.
@@ -1,24 +1,36 @@
@use 'sass:map';
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@use 'sass:map'; is unused in this stylesheet. Consider removing it to avoid dead imports and keep the theme files minimal.

Suggested change
@use 'sass:map';

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chat message typography defined in the wrong part

4 participants