Skip to content

Commit 09dfc9f

Browse files
Merge branch 'main' into tree-shaking
2 parents 0fcc0ed + 6dbaaf2 commit 09dfc9f

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

packages/module/src/MessageBox/MessageBox.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,28 @@
2424
}
2525

2626
@media screen and (min-width: 64rem) {
27-
.pf-chatbot--embedded,
2827
.pf-chatbot--drawer,
2928
.pf-chatbot--fullscreen {
3029
.pf-chatbot__messagebox {
3130
max-width: 60rem;
3231
width: 100%;
3332
}
3433
}
34+
35+
/*
36+
* Moves the scrollbar; see https://github.com/opendatahub-io/odh-dashboard/pull/8199
37+
*/
38+
.pf-chatbot--embedded .pf-chatbot__messagebox.pf-chatbot__messagebox--outer-scroll {
39+
width: 100%;
40+
max-width: unset;
41+
align-items: center;
42+
}
43+
44+
.pf-chatbot--embedded .pf-chatbot__messagebox.pf-chatbot__messagebox--outer-scroll > *:not(.pf-chatbot__messagebox-announcement) {
45+
max-width: 60rem;
46+
width: 100%;
47+
}
48+
3549
}
3650

3751
.pf-chatbot.pf-m-compact {

packages/module/src/MessageBox/MessageBox.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from 'react';
2020
import JumpButton from './JumpButton';
2121
import { ButtonProps, getResizeObserver, TooltipProps } from '@patternfly/react-core';
22+
import { css } from '@patternfly/react-styles';
2223

2324
export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
2425
/** Content that can be announced, such as a new message, for screen readers */
@@ -47,6 +48,8 @@ export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
4748
jumpButtonTopTooltipProps?: TooltipProps;
4849
/** Props passed to top jump button tooltip */
4950
jumpButtonBottomTooltipProps?: TooltipProps;
51+
/** Whether scrollbar is on the page or message box in embedded mode */
52+
hasOuterScrollbar?: boolean;
5053
}
5154

5255
export interface MessageBoxHandle extends HTMLDivElement {
@@ -115,6 +118,7 @@ export const MessageBox = forwardRef(
115118
jumpButtonBottomProps,
116119
jumpButtonBottomTooltipProps,
117120
jumpButtonTopTooltipProps,
121+
hasOuterScrollbar = false,
118122
...props
119123
}: MessageBoxProps,
120124
ref: ForwardedRef<MessageBoxHandle | null>
@@ -433,7 +437,12 @@ export const MessageBox = forwardRef(
433437
role="region"
434438
tabIndex={0}
435439
aria-label={ariaLabel}
436-
className={`pf-chatbot__messagebox ${position === 'bottom' ? 'pf-chatbot__messagebox--bottom' : ''} ${className ?? ''}`}
440+
className={css(
441+
'pf-chatbot__messagebox',
442+
position === 'bottom' && 'pf-chatbot__messagebox--bottom',
443+
hasOuterScrollbar && 'pf-chatbot__messagebox--outer-scroll',
444+
className
445+
)}
437446
ref={messageBoxRef}
438447
{...props}
439448
{...(enableSmartScroll ? { ...smartScrollHandlers } : {})}

0 commit comments

Comments
 (0)