-
27 Nov 2009 2:03 AM #1
[FNR] TabPanel key navigation
[FNR] TabPanel key navigation
Hello!
I just noticed that there's key navigation in TabPanel and it seems to be nice feature.
But there're some problems with nested elements:
Steps to reproduce:Code:Window window = new Window(); window.setLayout(new FitLayout()); window.setSize(600, 500); TabPanel tabPanel = new TabPanel(); TabItem firstItem = new TabItem("First item"); FormPanel formPanel = new FormPanel(); TextField<String> field = new TextField<String>(); formPanel.add(field); firstItem.add(formPanel); tabPanel.add(firstItem); TabItem secondItem = new TabItem("Second item"); tabPanel.add(secondItem); window.add(tabPanel); window.show();
1. Click in the field.
2. Type something.
3. Press "Home" - cursor moves to the beginning of the text.
4. Now press "End"
We expect that cursor moves to the end of the text in the field, but unfortunately TabPanel catches the event and opens "Second tab".
So TabPanel receives events that must be received only by the field currently focused.
If it is not a bug, please tell me how to solve this problem.
Thanks!
-
20 Jan 2010 9:45 PM #2
This bug is fixed in the releases/2.1 branch and is now available in the 2.1.1-beta release available here.
-
26 Jan 2010 5:41 AM #3
There is another problem when you have TabPanels nested inside other TabPanels. If the user presses HOME/END button all the nested TabPanels will switch to their own first/last TabItem.
A stopEvent() is required in TabPanel.onKeyPress() in order to stop the event from being propagated to parent elements.
The stopEvent() is already used for PAGEDOWN/PAGEUP in onRight()/onLeft(), but was missed for HOME/END buttons.
Thank you.
-
18 May 2010 8:11 AM #4
Hi..
Has anyone found a workaround for the HOME/END issue above? Causing me a few problems now.
Thanks
-
1 Jun 2010 5:35 AM #5
I just deleted (overrided) the HOME/END pairs from TabPanel.onKeyPress().
Code:@Override protected void onKeyPress(final ComponentEvent pCe) { final int code = pCe.getKeyCode(); switch (code) { case KeyCodes.KEY_RIGHT: case KeyCodes.KEY_PAGEDOWN: this.onRight(pCe); break; case KeyCodes.KEY_LEFT: case KeyCodes.KEY_PAGEUP: this.onLeft(pCe); break; // Removed End and Home key preferences, whiches cause input fields inconsistency } }
-
1 Jun 2010 5:37 AM #6
This should already be fixed in SVN for GXT 2.2
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote