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.56k stars 267 forks source link

[Feature Request]: Support autofocus attribute for ui5-input #7053

Closed TinaC closed 1 year ago

TinaC commented 1 year ago

Feature Request Description

For accessibility reason, we want to focus the first input in the dialog. https://stackoverflow.com/a/47067561/5238583

Proposed Solution

Since there is a HTML attribute that can do it, can we pass that to the Input component? https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus https://www.w3schools.com/tags/att_input_autofocus.asp https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_autofocus

<ui5-input autofocus></ui5-input>

Proposed Alternatives

No response

Additional Context

No response

Priority

None

Privacy Policy

dimovpetar commented 1 year ago

Hello @TinaC ,

The Dialog component has initialFocus property, which can be set to the ID of the input element you want. Have you tried it? https://sap.github.io/ui5-webcomponents/playground/components/Dialog/

Best regards, Petar

TinaC commented 1 year ago

Yes, it's working! Thanks for the solution