You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Helmut Swaczinna (JIRA)" <de...@myfaces.apache.org> on 2011/01/06 09:57:46 UTC
[jira] Created: (TOBAGO-961) Focus is lost after ajax reload
Focus is lost after ajax reload
-------------------------------
Key: TOBAGO-961
URL: https://issues.apache.org/jira/browse/TOBAGO-961
Project: MyFaces Tobago
Issue Type: Improvement
Components: Themes
Affects Versions: 1.0.33
Environment: All
Reporter: Helmut Swaczinna
When the component which owns the keyboard focus is on the reloaded part of the page, the focus is lost after ajax reload.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TOBAGO-961) Focus is lost after ajax reload
Posted by "Helmut Swaczinna (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TOBAGO-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978231#action_12978231 ]
Helmut Swaczinna commented on TOBAGO-961:
-----------------------------------------
I solved the problem. Apply this changes to tobago.js:
capturedFocusId: null,
captureFocus: function() {
if (document.activeElement) {
Tobago.capturedFocusId = document.activeElement.id;
}
},
restoreFocus: function() {
if (Tobago.capturedFocusId != null) {
var focusedElement = document.getElementById(Tobago.capturedFocusId);
if (focusedElement != null) {
focusedElement.focus();
if (focusedElement.select) {
focusedElement.select();
}
}
Tobago.capturedFocusId = null;
}
},
reloadComponent2: function(source, id, actionId, options) {
var reloadOptions = {
onSuccess: Tobago.captureFocus,
onComplete: Tobago.restoreFocus
};
if (options) {
reloadOptions = Tobago.extend(reloadOptions, options);
}
var container = this.ajaxComponents[id];
if (container) {
if (typeof container == "string") {
if (!actionId) {
actionId = container;
}
container = this.element(container);
Tobago.Updater.update2(source, container, this.page, actionId, id, reloadOptions);
} else if ((typeof container == "object") && container.tagName) {
if (!actionId) {
actionId = container.id;
}
Tobago.Updater.update2(source, container, this.page, actionId, id, reloadOptions);
} else if ((typeof container == "object") && (typeof container.reloadWithAction2 == "function")) {
if (!actionId) {
if (container.id) {
actionId = container.id;
} else {
actionId = "_tbg_no_action_";
}
}
container.reloadWithAction2(source, actionId, reloadOptions);
} else {
LOG.warn("Illegal container for reload:" + (typeof container));
}
} else {
LOG.warn("Cannot find container for '" + id + "'! Skipping reload!");
LOG.debugAjaxComponents();
}
},
> Focus is lost after ajax reload
> -------------------------------
>
> Key: TOBAGO-961
> URL: https://issues.apache.org/jira/browse/TOBAGO-961
> Project: MyFaces Tobago
> Issue Type: Improvement
> Components: Themes
> Affects Versions: 1.0.33
> Environment: All
> Reporter: Helmut Swaczinna
>
> When the component which owns the keyboard focus is on the reloaded part of the page, the focus is lost after ajax reload.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TOBAGO-961) Focus is lost after ajax reload
Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TOBAGO-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12989191#comment-12989191 ]
Bernd Bohmann commented on TOBAGO-961:
--------------------------------------
Can you provide a svn diff, please.
We have to analyse that this change doesn't conflict with lastFocusId and errorFocusId.
> Focus is lost after ajax reload
> -------------------------------
>
> Key: TOBAGO-961
> URL: https://issues.apache.org/jira/browse/TOBAGO-961
> Project: MyFaces Tobago
> Issue Type: Improvement
> Components: Themes
> Affects Versions: 1.0.32
> Environment: All
> Reporter: Helmut Swaczinna
>
> When the component which owns the keyboard focus is on the reloaded part of the page, the focus is lost after ajax reload.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (TOBAGO-961) Focus is lost after ajax reload
Posted by "Helmut Swaczinna (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TOBAGO-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978805#action_12978805 ]
Helmut Swaczinna commented on TOBAGO-961:
-----------------------------------------
I had to do some changes in restoreFocus():
restoreFocus: function() {
if (Tobago.capturedFocusId != null) {
var focusedElement = document.getElementById(Tobago.capturedFocusId);
if (focusedElement != null && focusedElement.focus && !focusedElement.disabled) {
try { // focus() on not visible elements breaks IE
focusElement.focus();
if (focusedElement.select) {
focusedElement.select();
}
} catch(ex) {
LOG.warn("Exception when setting focus on : \"" + Tobago.capturedFocusId + "\"");
}
}
Tobago.capturedFocusId = null;
}
},
> Focus is lost after ajax reload
> -------------------------------
>
> Key: TOBAGO-961
> URL: https://issues.apache.org/jira/browse/TOBAGO-961
> Project: MyFaces Tobago
> Issue Type: Improvement
> Components: Themes
> Affects Versions: 1.0.33
> Environment: All
> Reporter: Helmut Swaczinna
>
> When the component which owns the keyboard focus is on the reloaded part of the page, the focus is lost after ajax reload.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (TOBAGO-961) Focus is lost after ajax reload
Posted by "Helmut Swaczinna (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TOBAGO-961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Helmut Swaczinna updated TOBAGO-961:
------------------------------------
Status: Patch Available (was: Open)
> Focus is lost after ajax reload
> -------------------------------
>
> Key: TOBAGO-961
> URL: https://issues.apache.org/jira/browse/TOBAGO-961
> Project: MyFaces Tobago
> Issue Type: Improvement
> Components: Themes
> Affects Versions: 1.0.33
> Environment: All
> Reporter: Helmut Swaczinna
>
> When the component which owns the keyboard focus is on the reloaded part of the page, the focus is lost after ajax reload.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.