File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
message-feed/src/MessageFeed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,14 @@ import {
1515 Variant ,
1616} from '@leafygreen-ui/tokens' ;
1717
18+ /**
19+ * when `InputBar` is used in a drawer (or other context that restricts
20+ * the width of the container), we need to set a minimum width so that
21+ * `react-textarea-autosize` can properly calculate the initial height
22+ * of the textarea element.
23+ */
24+ const TEXT_AREA_MIN_WIDTH = 150 ;
25+
1826const baseFormStyles = css `
1927 width : 100% ;
2028` ;
@@ -100,6 +108,7 @@ export const getContentWrapperStyles = ({
100108 } ) ;
101109
102110const getBaseTextAreaStyles = ( { theme } : { theme : Theme } ) => css `
111+ min-width : ${ TEXT_AREA_MIN_WIDTH } px;
103112 width : 100% ;
104113 font-size : ${ BaseFontSize . Body1 } px;
105114 font-family : ${ fontFamilies . default } ;
Original file line number Diff line number Diff line change @@ -39,8 +39,13 @@ export const scrollContainerStyles = css`
3939 overflow-y : scroll;
4040 scroll-behavior : smooth;
4141 position : relative;
42- padding : 0 ${ spacing [ 400 ] } px ${ spacing [ 400 ] } px ;
42+ padding : 0 ${ spacing [ 400 ] } px;
4343 display : flex;
4444 flex-direction : column;
4545 gap : ${ spacing [ 400 ] } px;
4646` ;
47+
48+ // Ensures the intercept element is visible and considered by the browser
49+ export const interceptStyles = css `
50+ min-height : 1px ;
51+ ` ;
Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ import LeafyGreenProvider, {
1414
1515import { ScrollToLatestButton } from '../ScrollToLatestButton' ;
1616
17- import { getWrapperStyles , scrollContainerStyles } from './MessageFeed.styles' ;
17+ import {
18+ getWrapperStyles ,
19+ interceptStyles ,
20+ scrollContainerStyles ,
21+ } from './MessageFeed.styles' ;
1822import { MessageFeedProps } from '.' ;
1923
2024export const MessageFeed = forwardRef (
@@ -106,10 +110,10 @@ export const MessageFeed = forwardRef(
106110 >
107111 < div className = { scrollContainerStyles } ref = { scrollContainerRef } >
108112 { /* Empty span element used to track if container can scroll up */ }
109- < span ref = { topInterceptRef } />
113+ < span className = { interceptStyles } ref = { topInterceptRef } />
110114 { children }
111115 { /* Empty span element used to track if container can scroll down */ }
112- < span ref = { bottomInterceptRef } />
116+ < span className = { interceptStyles } ref = { bottomInterceptRef } />
113117 </ div >
114118 < ScrollToLatestButton
115119 darkMode = { darkMode }
You can’t perform that action at this time.
0 commit comments