Forms are commonly shown within modals. Having the modal plugin search for the first visible input and focusing on it if it is found would be very convenient. To prevent breaking usability, it should store the current document.activeElement just before the modal is shown and restore focus to it when the modal closes.
This makes sense as an enhancement.
You can emulate this behavior quite easily using onShow callback however, if you want this now.
This enhancement is added in pull request #836
There should be a way to disable this feature, not everyone wants their form to be submitted accidentally
Sure
@varemenos In my PR for this feature, I added a setting called "autofocus" that you could set to false in order to disable it. I'm not sure if it transitioned into the newer releases, since I don't see it in the docs anymore.
:+1: Could use the autofocus=false option.
Actually, @varemenos, this already works perfectly with autofocus: false. However, it is not in the docs currently. See PR #836
However, it is not in the docs currently
If it's not in the docs, it's not accessible...
I sound like an asshole but please understand my reasoning.
Perfectly reasonable. Just letting you know what I found. I ran into the same problem but checked the code and found it when I saw @ShimShamSam's reply.
Regardless, I already submitted a pull-request fix for the docs, Semantic-Org/Semantic-UI-Docs#34 - should be fixed soon.
Pull request was accepted and is now live. This is now in the docs.
Thanks @abernix
Most helpful comment
There should be a way to disable this feature, not everyone wants their form to be submitted accidentally