spModal autofocus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 12:35 PM
Is there a way to change where spModal autofocuses?
When I open spModal, it always focuses on the X button.
I would like to focus on the modal title when it opens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 03:11 PM
Hi, no answer from me to solve this. But I was happy to see your question. Was struggeling with this months ago, and I never post a question or ask for help. But yes I DO want to still fix it 🙂 So hope someone will have the answer and I will be in the loop for it as well. I tried setting focus on other things, but never got it to work. For something OOTB I found this very annoying to work like this as it is a visual thing that realy looks not nice in the page. Hope someone can help you fix it. Good luck!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 08:49 AM - edited ‎07-08-2024 08:56 AM
After reading the accepted solution on this post, I tried adding "focus: true" on the button I wanted initial focus on (and no longer on the 'X') and it worked, resulting in this:
spModal.open({
title: 'Modal Title',
message: 'Modal content goes here',
buttons: [
{label:'Cancel', cancel: true, focus: true}, //<<-- see the "focus: true" here
{label:'OK', primary: true}
]
})

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 12:21 PM
@cnough please mark as answered (if think so) so others can see how to solve this - thanks!