@@ -46,7 +46,6 @@ const CHAT_MESSAGE_TAG = "shiny-chat-message";
4646const CHAT_USER_MESSAGE_TAG = "shiny-user-message" ;
4747const CHAT_MESSAGES_TAG = "shiny-chat-messages" ;
4848const CHAT_INPUT_TAG = "shiny-chat-input" ;
49- const CHAT_INPUT_SENTINEL_TAG = "shiny-chat-input-sentinel" ;
5049const CHAT_CONTAINER_TAG = "shiny-chat-container" ;
5150
5251const ICONS = {
@@ -263,7 +262,6 @@ class ChatInput extends LightElement {
263262}
264263
265264class ChatContainer extends LightElement {
266- inputSentinel ?: HTMLElement ;
267265 inputSentinelObserver ?: IntersectionObserver ;
268266
269267 private get input ( ) : ChatInput {
@@ -288,15 +286,14 @@ class ChatContainer extends LightElement {
288286
289287 // We use a sentinel element that we place just above the shiny-chat-input. When it
290288 // moves off-screen we know that the text area input is now floating, add shadow.
291- let sentinel = this . querySelector < HTMLElement > ( CHAT_INPUT_SENTINEL_TAG ) ;
289+ let sentinel = this . querySelector < HTMLElement > ( "div" ) ;
292290 if ( ! sentinel ) {
293- sentinel = createElement ( CHAT_INPUT_SENTINEL_TAG , {
294- style : "width: 100%; height: 0" ,
291+ sentinel = createElement ( "div" , {
292+ style : "width: 100%; height: 0; " ,
295293 } ) as HTMLElement ;
296294 this . input . insertAdjacentElement ( "afterend" , sentinel ) ;
297295 }
298296
299- this . inputSentinel = sentinel ;
300297 this . inputSentinelObserver = new IntersectionObserver (
301298 ( entries ) => {
302299 const inputTextarea = this . input . querySelector ( "textarea" ) ;
@@ -310,7 +307,7 @@ class ChatContainer extends LightElement {
310307 }
311308 ) ;
312309
313- this . inputSentinelObserver . observe ( this . inputSentinel ) ;
310+ this . inputSentinelObserver . observe ( sentinel ) ;
314311 }
315312
316313 firstUpdated ( ) : void {
@@ -340,7 +337,7 @@ class ChatContainer extends LightElement {
340337 super . disconnectedCallback ( ) ;
341338
342339 this . inputSentinelObserver ?. disconnect ( ) ;
343- this . inputSentinel ?. remove ( ) ;
340+ this . inputSentinelObserver = undefined ;
344341
345342 this . removeEventListener ( "shiny-chat-input-sent" , this . #onInputSent) ;
346343 this . removeEventListener ( "shiny-chat-append-message" , this . #onAppend) ;
0 commit comments