ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

TextArea make AutoFocus attribute work

Open Nils-Schiwek opened this issue 1 year ago • 4 comments

Is your feature request related to a problem?

I would like to have focus on a Textbox the moment it is rendered. I usually use the autoFocus attribute for that, but it does not work for the UI5 Textbox.

Describe the solution you'd like

I would like to have an easy way to move focus to the Textbox on render.

Describe alternatives you've considered

It would also be possible to add a reference to the textarea using useRef and utilize that to switch focus through useEffect.

Additional Context

the attribute autoFocus={true} should be working on TextArea like described in https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus

Organization

No response

Declaration

  • [X] I’m not disclosing any internal or sensitive information.

Nils-Schiwek avatar May 27 '24 08:05 Nils-Schiwek

Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.

MarcusNotheis avatar May 27 '24 10:05 MarcusNotheis

Hello @SAP/ui5-webcomponents-topic-core ,

The reporter would like to focus the TextArea with its initial rendering by using the autofocus attribute.

Currently this is not possible with any of the components, even if it has the shadowRootOptions: { delegatesFocus: true }, configuration.

It seems like it's shadow root limitation, but I would like you to have the final word.

Regards, Plamen Ivanov

plamenivanov91 avatar May 27 '24 15:05 plamenivanov91

Hi @dobrinyonkov , @MapTo0 , @TeodorTaushanov , @tsanislavgatev,

Seems like property that should be implemented by each component separately at least for some input like components because if the autofocus attribute is set to the custom element that has delegateFocus: true in the initial rendering focusable DOM reference might not exists.

Lets discuss it offline.

nnaydenow avatar Jul 10 '24 13:07 nnaydenow

Any news regarding this issue?

akamom avatar Sep 18 '24 13:09 akamom