cfnz / muirwik

Muirwik - a Material UI React wrapper written in Kotlin
Mozilla Public License 2.0
132 stars 25 forks source link

In mListItem with button=false autoFocus is not work #74

Closed LSDsl closed 3 years ago

LSDsl commented 3 years ago

mListItem(button = false..) { attrs.autoFocus = true }

Expected: list will scroll to this item and item will be visible on screen Got: list not scroll to item

lib version 0.9.1

cfnz commented 3 years ago

This is the behaviour of the underlying Material-UI library when button is false.

You can't click on or select the item, so I guess it can't be focused either.

LSDsl commented 3 years ago

How I can scroll to some element in this case?

cfnz commented 3 years ago

Here is some info that someone raised on the same issue in Material-UI, and they said go to Stack Overflow, so here is a Stack Overflow answer.

If you have different sized items, like dividers, headers, etc., might get a bit complicated... Looks like the easier answer would be if you could make it a button (and you could style it so it doesn't have to look like a button), then you could use autoFocus.