File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,6 +223,10 @@ export class BaseForm extends LitElement {
223223 form ?. reset ( ) ;
224224 }
225225
226+ setFocus ( ) {
227+ this . textareaRef . value ?. focus ( ) ;
228+ }
229+
226230 static override styles = [
227231 varStyles ,
228232 baseStyles ,
Original file line number Diff line number Diff line change @@ -38,6 +38,15 @@ export class ReplyForm extends LitElement {
3838
3939 baseFormRef : Ref < BaseForm > = createRef < BaseForm > ( ) ;
4040
41+ override connectedCallback ( ) : void {
42+ super . connectedCallback ( ) ;
43+
44+ setTimeout ( ( ) => {
45+ this . scrollIntoView ( { block : 'center' , inline : 'start' , behavior : 'smooth' } ) ;
46+ this . baseFormRef . value ?. setFocus ( ) ;
47+ } , 0 ) ;
48+ }
49+
4150 override render ( ) {
4251 return html `< base-form ${ ref ( this . baseFormRef ) } @submit ="${ this . onSubmit } "> </ base-form > ` ;
4352 }
You can’t perform that action at this time.
0 commit comments