Wicket
  1. Wicket
  2. WICKET-1404

Investigate default focus support (on Page or RequestCycle)

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None

      Description

      We need something which gives a component the focus when the page loads.

        Activity

        James Carman created issue -
        Hide
        James Carman added a comment -

        Here's a patch that implements the behavior. I haven't the foggiest idea of how to test this thing, so I'll leave that up to you gurus. Also, you'll probably need to add a @since tag once you decide when this goes in (if it does).

        Show
        James Carman added a comment - Here's a patch that implements the behavior. I haven't the foggiest idea of how to test this thing, so I'll leave that up to you gurus. Also, you'll probably need to add a @since tag once you decide when this goes in (if it does).
        James Carman made changes -
        Field Original Value New Value
        Attachment WICKET-1404.patch [ 12377483 ]
        Johan Compagner made changes -
        Fix Version/s 1.5-M1 [ 12313078 ]
        Hide
        James Carman added a comment -

        Do you want me to upload another patch that overrides the isTemporary() method? Is this even going to go into the framework?

        Show
        James Carman added a comment - Do you want me to upload another patch that overrides the isTemporary() method? Is this even going to go into the framework?
        Hide
        Johan Compagner added a comment -

        see the discussion we had before on the list
        A behavior is the wrong way to go.

        focus is a single thing that should be handled on 1 place in 1 request (like Page or RequestCycle)

        Show
        Johan Compagner added a comment - see the discussion we had before on the list A behavior is the wrong way to go. focus is a single thing that should be handled on 1 place in 1 request (like Page or RequestCycle)
        Hide
        James Carman added a comment -

        That's what I thought. I guess I was just surprised that you didn't just close this as "wontfix". I still think this could be useful for some folks. I didn't realize that isTemporary() was even there at first. If this could be temporary, I don't think it's that big of a deal. You would be setting the default focus in your java code, so if you tried to do it to more than one component, then shame on you. Either way, it's no big deal to me. It's in the Wiki, so if folks want to use it they can.

        Show
        James Carman added a comment - That's what I thought. I guess I was just surprised that you didn't just close this as "wontfix". I still think this could be useful for some folks. I didn't realize that isTemporary() was even there at first. If this could be temporary, I don't think it's that big of a deal. You would be setting the default focus in your java code, so if you tried to do it to more than one component, then shame on you. Either way, it's no big deal to me. It's in the Wiki, so if folks want to use it they can.
        Hide
        Johan Compagner added a comment -

        i will change the title then..

        Show
        Johan Compagner added a comment - i will change the title then..
        Johan Compagner made changes -
        Summary DefaultFocusBehavior Investigate default focus support (on Page or RequestCycle)
        Description We need a behavior which gives a component the focus when the page loads. We need something which gives a component the focus when the page loads.
        Hide
        James Carman added a comment -

        Ahhhh. Much better. I still thought we were talking about doing my original idea on this issue. But, setting up a focus manager or something like that on the page/request cycle would be nice.

        Show
        James Carman added a comment - Ahhhh. Much better. I still thought we were talking about doing my original idea on this issue. But, setting up a focus manager or something like that on the page/request cycle would be nice.
        Igor Vaynberg made changes -
        Fix Version/s 1.5-M2 [ 12315237 ]
        Fix Version/s 1.5-M1 [ 12313078 ]
        Igor Vaynberg made changes -
        Fix Version/s 1.5-M3 [ 12315329 ]
        Fix Version/s 1.5-M2 [ 12315237 ]
        Hide
        Anatoly Kupriyanov added a comment -

        It's bad idea to set focus from the onload event. This event could occur after a control is visible and a user starts edit the control - focus suddenly jumps to another one.
        I hate this - I open page, it still loading but login/password form already rendered and while I'm typing a password, page finishes loading and focus suddenly jumps to the login box, it could reveal my password.
        Usually it's better to put getElementById('" + component.getMarkupId() + "').focus() right after form component.

        Show
        Anatoly Kupriyanov added a comment - It's bad idea to set focus from the onload event. This event could occur after a control is visible and a user starts edit the control - focus suddenly jumps to another one. I hate this - I open page, it still loading but login/password form already rendered and while I'm typing a password, page finishes loading and focus suddenly jumps to the login box, it could reveal my password. Usually it's better to put getElementById('" + component.getMarkupId() + "').focus() right after form component.
        Hide
        Igor Vaynberg added a comment -

        thats why there is also ondomready() which shouldnt suffer from that problem.

        Show
        Igor Vaynberg added a comment - thats why there is also ondomready() which shouldnt suffer from that problem.
        Jeremy Thomerson made changes -
        Fix Version/s 1.5-M4 [ 12315483 ]
        Fix Version/s 1.5-M3 [ 12315329 ]
        Martin Grigorov made changes -
        Fix Version/s 1.5-M4 [ 12315483 ]
        Hide
        Martin Grigorov added a comment -

        Is this really needed in -core ? it is quite simple to roll out yourself.
        I haven't seen anyone asking for this in the mailing lists..

        Show
        Martin Grigorov added a comment - Is this really needed in -core ? it is quite simple to roll out yourself. I haven't seen anyone asking for this in the mailing lists..
        Hide
        James Carman added a comment -

        I guess it's a matter of philosophy.

        Show
        James Carman added a comment - I guess it's a matter of philosophy.
        Hide
        Martin Grigorov added a comment -

        I guess you are right

        A question: should this behavior be used only for FormComponents or it should be extended to add 'tabindex' parameter for non-FormComponents to be able to focus such ?

        Show
        Martin Grigorov added a comment - I guess you are right A question: should this behavior be used only for FormComponents or it should be extended to add 'tabindex' parameter for non-FormComponents to be able to focus such ?

          People

          • Assignee:
            Unassigned
            Reporter:
            James Carman
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development