SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.47k stars 254 forks source link

TextArea make AutoFocus attribute work #9063

Open Nils-Schiwek opened 1 month ago

Nils-Schiwek commented 1 month ago

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

MarcusNotheis commented 1 month ago

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

plamenivanov91 commented 1 month ago

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