svelte-material-ui icon indicating copy to clipboard operation
svelte-material-ui copied to clipboard

Setting Focus On Select

Open wcrisman opened this issue 2 years ago • 1 comments

It appears that there is some issue programmatically setting the Select component to be focused. The following does not actually focus the Select component, but it works fine with a TextField component. Clicking tab will switch the focus to the Select.

const init = () => {document.getElementsByClassName('focusMe')[0].focus()}; <div use:init><Select class="focusMe" ...>...</Select></div>

wcrisman avatar Jul 10 '22 18:07 wcrisman

It would also be really nice to be able to use the use:init on the Select component instead of having to put it in the wrapper.

Also nice would be some documentation on various ways to programmatically focus SMUI elements in situations like when a component is loaded due to some user interaction on the page. I could not find such documentation on the SMUI page, and what I could find for general Svelte was all centered around the page being loaded (versus user interaction that loads additional elements).

wcrisman avatar Jul 10 '22 18:07 wcrisman