tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

Can't override Dialog autofocus #420

Open nickzelei opened 7 years ago

nickzelei commented 7 years ago

I'm running into an issue with the dialog auto focusing elements that I didn't specify to autofocus.

Here are a few cases that I am talking about.

Case 1: A dialog that only has text in its body but has Action buttons, the Dialog will autofocus the first button listed in the action items regardless of whether I set auto focus or not.

Case 2: The dialog has two input fields in its DialogContent and I do not have auto focus set on either input. The dialog still auto focuses the first input in the Content.

Case 3: The dialog has two input fields in its Dialog Content and I have set autoFocus on the second input. The dialog still auto focuses the first input and completely ignores my autoFocus on the second.

Danbardo commented 7 years ago

Sorry, this isn't a solution to your problem. I was looking for a solution to a similar problem, mainly I just wanted to disable autofocus completely. This is the closest question that came up, so for anyone else who would like to disable autofocus here are two options:

If you don't care that the object is focused on then just set the styling to match the background colour of the parent div. .mdl-button:focus:not(:active){ background-color:#fff; }

If you do care, make a