ICEfaces
  1. ICEfaces
  2. ICE-9962

ace:dialog - Add new "setFocus" attribute

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: EE-3.3.0.GA_P02, 4.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 4.x
    • Assignee Priority:
      P3
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      A potential workaround for this is to use the new icecore:focusManager component on the page, and have the application programmatically set the focus to the desired field inside the ace:dialog when it is shown via "visible=true", by specifying the id of the component to receive focus in the focusManager's "for" attribute.
      Show
      A potential workaround for this is to use the new icecore:focusManager component on the page, and have the application programmatically set the focus to the desired field inside the ace:dialog when it is shown via "visible=true", by specifying the id of the component to receive focus in the focusManager's "for" attribute.

      Description

      It would be a nice feature if the ace:dialog supported a new "setFocus" attribute that could be set to define the id of a component contained within the ace:dialog that should receive focus whenever the dialog is made visible, either via the the visible attribute or JavaScript API.

      This would provide an easy mechanism for applications to have focus be moved to a component inside the dialog when it is presented. Currently, focus is generally persisted on the component that triggers the dialog being made visible, which is usually not the desired outcome.

        Issue Links

          Activity

          Hide
          Ken Fyten added a comment -

          Added a workaround based on the new ice core:focusManager technique. However, this workaround would only potentially work with cases where the dialog is being displayed via the server-side "visible" attribute being set to true, and would not support the client-side use-case where the dialog has already been rendered and is being displayed via JavaScript.

          For the client-side scenario, having the "setFocus" attribute on the ace:dialog would be handy as it could be pre-rendered with the correct value, and that field would automatically receive focus whenever the dialog was displayed, regardless of whether that was via "visible=true" or the client-side JavaScript API.

          Show
          Ken Fyten added a comment - Added a workaround based on the new ice core:focusManager technique. However, this workaround would only potentially work with cases where the dialog is being displayed via the server-side "visible" attribute being set to true, and would not support the client-side use-case where the dialog has already been rendered and is being displayed via JavaScript. For the client-side scenario, having the "setFocus" attribute on the ace:dialog would be handy as it could be pre-rendered with the correct value, and that field would automatically receive focus whenever the dialog was displayed, regardless of whether that was via "visible=true" or the client-side JavaScript API.
          Hide
          Ken Fyten added a comment -

          The suggested order of precedence for the ace:dialog "setFocus" attribute in cases where an icecore:focusManager was present on the page is as follows:

          1. "for" attribute if defined on the focusManager
          2. "setFocus" attribute if defined on the dialog
          3. Any invalid component
          Show
          Ken Fyten added a comment - The suggested order of precedence for the ace:dialog "setFocus" attribute in cases where an icecore:focusManager was present on the page is as follows: "for" attribute if defined on the focusManager "setFocus" attribute if defined on the dialog Any invalid component
          Hide
          Mircea Toma added a comment -

          Introduced 'setFocus' attribute that can define which component (found inside the dialog) will receive focus once the dialog opens.

          Show
          Mircea Toma added a comment - Introduced 'setFocus' attribute that can define which component (found inside the dialog) will receive focus once the dialog opens.
          Hide
          Carmen Cristurean added a comment - - edited

          On EE-3.3.0-maintenance branch (# 40878) , setFocus attribute is not functional for ACE components inside the ace:dialog (ace:textEntry, ace:textAreaEntry, etc.). However it works for h: input components inside ace:dialog.

          This is not an issue on ICEfaces4 trunk, where setFocus works for both ACE components and h: components inside ace:dialog.

          QA test app: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces2/Sparkle/Nightly/dialog
          Test pages:
          /dialogSetFocus.xhtml
          /dialogAttribute.jsf

          Show
          Carmen Cristurean added a comment - - edited On EE-3.3.0-maintenance branch (# 40878) , setFocus attribute is not functional for ACE components inside the ace:dialog (ace:textEntry, ace:textAreaEntry, etc.). However it works for h: input components inside ace:dialog. This is not an issue on ICEfaces4 trunk, where setFocus works for both ACE components and h: components inside ace:dialog. QA test app: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces2/Sparkle/Nightly/dialog Test pages: /dialogSetFocus.xhtml /dialogAttribute.jsf
          Hide
          Carmen Cristurean added a comment -

          On IF4 trunk and EE-3.3.0-maintenance (#40900), setFocus attribute doesn't work if opening the dialog component using a submit type button with actionListener.

          Test page: /dialogSetFocus1.jsf
          Steps:

          • select the second component from the drop-down (in222).
          • click the first 'Show' button (type=button) -> dialog is rendered and the second inputText component has the focus.
          • hide the dialog, then click the second 'Show' button (type=submit) -> dialog is rendered with both inputText components without focus.
          Show
          Carmen Cristurean added a comment - On IF4 trunk and EE-3.3.0-maintenance (#40900), setFocus attribute doesn't work if opening the dialog component using a submit type button with actionListener. Test page: /dialogSetFocus1.jsf Steps: select the second component from the drop-down (in222). click the first 'Show' button (type=button) -> dialog is rendered and the second inputText component has the focus. hide the dialog, then click the second 'Show' button (type=submit) -> dialog is rendered with both inputText components without focus.
          Hide
          Mircea Toma added a comment -

          Modified ice.ace.Dialog constructor to move focus on the specified element (or first input element when not specified) when an update creates the dialog.

          Show
          Mircea Toma added a comment - Modified ice.ace.Dialog constructor to move focus on the specified element (or first input element when not specified) when an update creates the dialog.
          Hide
          Mircea Toma added a comment - - edited

          The setFocus attribute feature is not working with EE-3.3.0-maintenance branch based components because ICE-9483 who modified ACE components to implement the Focusable interface was targeted only to 4.0.BETA. Components that implement the Focusable interface return the ID of the element that should receive focus within the markup rendered by the in focus component. By default the focus is applied to the root element in the markup which usually works well for simpler component (such as h:* input components)

          Show
          Mircea Toma added a comment - - edited The setFocus attribute feature is not working with EE-3.3.0-maintenance branch based components because ICE-9483 who modified ACE components to implement the Focusable interface was targeted only to 4.0.BETA. Components that implement the Focusable interface return the ID of the element that should receive focus within the markup rendered by the in focus component. By default the focus is applied to the root element in the markup which usually works well for simpler component (such as h:* input components)
          Hide
          Ken Fyten added a comment -

          Added a note to the TLD doc for the setFocus attribute on the 3.3 maintenance branch only to warn that this attribute is not reliable when used with ACE components - "Specifies the ID of the component contained within the dialog that should receive focus when the dialog is made visible. Note that this feature does not work with ACE components in this release (h: and ice: are supported)."

          Resolved.

          Show
          Ken Fyten added a comment - Added a note to the TLD doc for the setFocus attribute on the 3.3 maintenance branch only to warn that this attribute is not reliable when used with ACE components - "Specifies the ID of the component contained within the dialog that should receive focus when the dialog is made visible. Note that this feature does not work with ACE components in this release (h: and ice: are supported)." Resolved.

            People

            • Assignee:
              Ken Fyten
              Reporter:
              Ken Fyten
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: