Forum Discussion

BrettConlon's avatar
BrettConlon
Community Member
6 months ago

How to get a Text Entry field to auto-focus when a layer loads

G'day,

I have a Text Entry field that I'd like to have auto-focus when the layer it's sitting on is triggered to load so you can immediately start typing into it. At the moment, the field sits on top of a coloured box with a "Continue" button next to it. It's a field that the Learn Admin enters a password into, which then puts the course into "Admin mode" allowing them to jump around the course without the usual "NEXT" button restrictions - helpful for quickly troubleshooting course issues. When the "Admin Access layer loads, the field is not focused and you have to first click in the field before you can start typing.

I read another Storyline Forum thread (HERE) on this same issue and they recommended using the "Focus Order" window to set the order of the objects that get jumped to when the user presses the Tab key, but I don't want them to have to press the tab key at all, I just need it to be automatically focused. Another contributor said that the object has to be at the bottom of the timeline (ie. the lowest object in the layering) and that actually works (the field is auto-focused when the layer appears) but I need my Text Entry field to be on top of a coloured box, so that's not going to work for me.

Is there another/proper way to achieve this?

As a workaround, I'm thinking of sending the Text Entry field to be the bottom object and then creating a series of boxes that surround the field (making it appear like its under the field), but I also have a larger 50% transparent, white box under that that I'll have to do the same thing with - a rather kludgy workaround.

Many thanks, Brett

  • AndrewHanley's avatar
    AndrewHanley
    Community Member

    G'day Brett!

    There's a super easy little hack for this.

    If your text field is the only thing on a layer, it will auto focus. That's it! :)

    So pop your content on one layer, and the text field on another.

    (Don't forget to change the text field LAYER PROPERTIES so that "hide other slide layers" is unticked)

    No worries mate! ;)

  • BrettConlon's avatar
    BrettConlon
    Community Member

    Hi Andrew - stellar idea!

    Last night when I made this post I was getting timeout errors and didn't even think the post uploaded. To my surprise, I found out today I now have 2 of the same post uploaded. The other one is HERE. Could you please drop your response in the other post and I'll then delete this one?

    Ta muchly!

  • BrettConlon's avatar
    BrettConlon
    Community Member

    Strangely, your post is showing as greyed out and I noticed it has "Reported" underneath it. I wonder why? Is that an automated thing because the same content is posted in another thread? Weird...

  • Hi,

    I'm having a similar issue to Brett, however I've tried Andrew's suggestion, but it's not working.

    I have my text field on the base layer (and this is the only thing on this layer), and then I created another layer (let's call this Layer 2) with all of the other content. It didn't auto focus on the text field and the entire screen was blank (I had to click onto the text field and type still). I then tried to add a trigger to 'Show Layer 2' when the timeline starts on this slide, so at least the screen had the content, but still no auto focusing and the text doesn't appear on top of Layer 2, so I can't see what I'm typing.

    I've tried to put the content as a background image, however it becomes extremely blurry.

    Even tried to change the focus order, however it doesn't autofocus for me to type without having to click on the text field.

    What am I doing wrong?

    Ben

    • KellyAuner's avatar
      KellyAuner
      Staff

      Hi BenjaminLee-a52!

      If you're willing to share your file, it may help troubleshoot the issue. You can attach it here or share it with our team privately in a support case. We'll delete it from our systems once troubleshooting is complete.

  • I'm hitting the same issue. I've created a new slide with a single layer to show what I'm doing in the attachment. The slide has a rectangle that triggers showing the layer when clicked. The layer only has the text entry field on it, but still needs to be clicked in to so the user can type. 

    What am I missing?

  • BrettConlon's avatar
    BrettConlon
    Community Member

    Daing, I wish I could recall what I did to fix this but it was a while ago and I had to rush onto other things and didn't put my solution in here.

    Looking now at the file that was previously NOT working and IS now focusing properly, I can't see any evidence of what I did to get it working so I'll just share how I have it set up so that even that information may help others.

    1. My Text Entry field is on a separate layer that gets triggered to Show when the learner clicks on a button. For my slide, I only have the base layer and the "Admin Access" layer (that has the Text Entry field and 6 other objects on it).
    2. The layer properties only has "Hide other slide layers" ticked (nothing else)
    3. The Text Entry field is currently sitting 5th from the top of 7 elements (so it's NOT on top or on the bottom). Even when I send the field to the top or bottom of the object layering (when on bottom, that puts it under other objects) the cursor is flashing, ready for input, when I preview it.
    4. I don't have any special triggers set up to try and give it focus
    5. The Focus Order shows that the Text Entry field is 7th from the top so nothing altered/special there.

    Basically, I now have no idea why it's working. From memory, I was desperately stabbing around trying all sorts of things to get it to work (when I first created this thread) and, if my memory serves me correctly, it somehow just started to work so I copied the layer to other projects, as needed.

    Sorry I can't offer anything more definitive. If I figure it out at a later date, I'll drop a note in here.

    Rgds, Brett