[MGNLUI-3452] Using keyboard to switch and select tab Created: 04/Jun/15  Updated: 14/Jul/15  Resolved: 29/Jun/15

Status: Closed
Project: Magnolia UI
Component/s: user interaction
Affects Version/s: 5.2
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Sang Ngo Huu Assignee: Sang Ngo Huu
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 4d 5h
Original Estimate: 5h

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

To switch between tabs using the keyboard, you use the arrow keys to change the focus to a different tab, then switch to it by e.g. pressing SPACE.



 Comments   
Comment by Sang Ngo Huu [ 29/Jun/15 ]

Arrow keys is used for moving text pointer by default. BTW when a tab is selected, the first field in tab content will be focused, we must move the focus back to tab.
I tried with CTRL + Arrow key, but it is conflict with browser shortcut.
If we don't use common keys, it is not meanful, I mean using CTRL+ALT+SHIFT+X key for next tab for example.

If still want to have shortcut, code should be added to:
info.magnolia.ui.vaadin.form.Form#constructor

        UI ui = UI.getCurrent();
        if (ui != null) {
            WebBrowser browser = ui.getPage().getWebBrowser();
            int[] osSpecificModifierKeys;
            if (browser.isWindows()) {
                osSpecificModifierKeys = new int[] { ModifierKey.CTRL, ModifierKey.ALT };
            } else {
                // osx and linux
                osSpecificModifierKeys = new int[] { ModifierKey.META, ModifierKey.ALT };
            }

            addShortcutListener(new ShortcutListener("", KeyCode.ARROW_RIGHT, osSpecificModifierKeys) {
                @Override
                public void handleAction(Object sender, Object target) {
                    tabSheet.setActiveTab(tabSheet.getNextTab(tabSheet.getActiveTab()));
                }
            });

            addShortcutListener(new ShortcutListener("", KeyCode.ARROW_RIGHT, osSpecificModifierKeys) {
                @Override
                public void handleAction(Object sender, Object target) {
                    tabSheet.setActiveTab(tabSheet.getPreviousTab(tabSheet.getActiveTab()));
                }
            });
        }

Closed issue and mark it won't fix.

Generated at Mon Feb 12 09:06:45 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.