Tab order on prompt page

87 views Asked by At

Using Cognos Analtyics 11.1.7IF9.

I have a user who, oddly enough, wants Cognos to make his workflow more efficient. (The nerve!) He thinks that if he can use the TAB button to navigate a prompt page, he'll be faster because he never needs to reach for the mouse.

To test this I created a simple report with a very simple prompt page using only textbox prompts. As I tab I notice it tabs to everything in the browser: browser tabs, the address bar, other objects in Cognos, ...even the labels (text items) I created for the prompts. Oh... and yes, at some point focus lands on a prompt control.

Within Cognos, I see that the tab order generally appears to be from the top down. (I haven't tried multiple columns of prompts in a table yet.) I must tab through the visual elements between the prompts. Also, while value prompts get focus, there is no visible indication of this.

Is there a way to set the tab order for the prompts on a prompt page?

Can I force it to skip the non-prompt elements?

Can the prompts be made to indicate that they have focus?

I tagged this question with because I figure the answer will likely involve a Custom Control or a Page Module.

Of course, then I'll need to figure out how all this will work with cascading prompts and conditional blocks.

I found a similar post complaining about this being a problem in Cognos 8. The answer contains no detail. It just says to go to a non-existent web page.

1

There are 1 answers

0
Michael-Webb On

I had the same frustration as your user and I made a solution a while back that could work for you. It's not the most elegant javascript and I get a weird error in the console but functionally it works so I haven't needed to fix it.

I created a custom control script that does 2 things on a prompt page.

First, it removes the ability to "select" text item elements on the page. If you only have text items and prompts on the page it sets it's "Tabindex" to "-1". This allows you to tab from one prompt field to the next without it selecting invisible elements or text elements between prompts.

Secondly, if you press "Enter" on the keyboard it automatically submits the form. I am pasting the code below which you can save as a .js and call it in a custom control on a prompt page. Set the UI Type to "None"

define( function() {
    "use strict";
    
    function AdvancedControl()
    {       
    };
    AdvancedControl.prototype.initialize = function( oControlHost, fnDoneInitializing )
    {
        function enterSubmit (e) 
       {
            if(e.keyCode === 13) 
            {
                try {oControlHost.finish();} catch {}                     
            }    
        };
        function setTab () {
            let nL = [...document.querySelectorAll("[specname=textItem]")]
            //console.log(nL)
            nL.forEach((node) =>{
                node.setAttribute('tabindex','-1')
            })
        };
        setTab();
        let exec_submit = document.addEventListener("keydown", enterSubmit, false);
        try {exec_submit;} catch {}
    fnDoneInitializing();
    };
return AdvancedControl;
});