How to use setTabIndex method in wpt

Best JavaScript code snippet using wpt

aria.js

Source:aria.js Github

copy

Full Screen

...36 if (domEvent ||37 // 初始化38 activeIndex == -1) {39 S.each(triggers, function (t) {40 setTabIndex(t, -1);41 });42 S.each(panels, function (t) {43 setTabIndex(t, -1);44 });45 if (trigger) {46 setTabIndex(trigger, 0);47 }48 setTabIndex(panel, 0);49 //dom 事件触发时,才会进行聚焦,否则会干扰用户50 if (domEvent) {51 panel.focus();52 }53 }54 }55 function findTrigger(t) {56 var r = null;57 S.each(this.triggers, function (trigger) {58 if (trigger == t59 || DOM.contains(trigger, t)) {60 r = trigger;61 return false;62 }63 });64 return r;65 }66 function next(c) {67 var n = DOM.next(c),68 triggers = this.triggers;69 if (!n) {70 n = triggers[0];71 }72 setTabIndex(c, -1);73 if (n) {74 setTabIndex(n, 0);75 n.focus();76 }77 }78 function prev(c) {79 var n = DOM.prev(c),80 triggers = this.triggers;81 if (!n) {82 n = triggers[triggers.length - 1];83 }84 setTabIndex(c, -1);85 if (n) {86 setTabIndex(n, 0);87 n.focus();88 }89 }90 function _navKeydown(e) {91 var key = e.keyCode,92 self = this,93 t = e.target,94 c;95 switch (key) {96 case KEY_DOWN:97 case KEY_RIGHT:98 c = findTrigger.call(self, t);99 if (c) {100 next.call(self, c);101 e.halt();102 }103 break;104 case KEY_UP:105 case KEY_LEFT:106 c = findTrigger.call(self, t);107 if (c) {108 prev.call(self, c);109 e.halt();110 }111 break;112 case KEY_ENTER:113 case KEY_SPACE:114 c = findTrigger.call(self, t);115 if (c) {116 self.switchTo(S.indexOf(c, self.triggers),117 undefined, DOM_EVENT);118 e.halt();119 }120 break;121 }122 }123 function findPanel(t) {124 var r = null;125 S.each(this.panels, function (p) {126 if (p == t || DOM.contains(p, t)) {127 r = p;128 return false;129 }130 });131 return r;132 }133 function nextPanel(c) {134 var self = this,135 n = DOM.next(c),136 panels = self.panels;137 if (!n) {138 n = panels[0];139 }140 setTabIndex(c, -1);141 setTabIndex(n, 0);142 if (checkPanel.call(self, n, FORWARD)) {143 n.focus();144 }145 }146 function prevPanel(c) {147 var n = DOM.prev(c),148 self = this,149 panels = self.panels;150 if (!n) {151 n = panels[panels.length - 1];152 }153 setTabIndex(c, -1);154 setTabIndex(n, 0);155 if (checkPanel.call(self, n, BACKWARD)) {156 n.focus();157 }158 }159 function checkPanel(p, direction) {160 var self = this,161 index = S.indexOf(p, self.panels),162 steps = self.config.steps,163 dest = Math.floor(index / steps);164 // 在同一个 panel 组,立即返回165 if (dest == self.activeIndex) {166 return 1;167 }168 if (index % steps == 0 || index % steps == steps - 1) {169 //向前动画滚动中,focus,会不正常 ...170 //传递事件,动画后异步 focus171 self.switchTo(dest, direction, DOM_EVENT);172 return 0;173 }174 return 1;175 }176 function _contentKeydown(e) {177 var self = this,178 key = e.keyCode,179 t = e.target,180 c;181 switch (key) {182 case KEY_DOWN:183 case KEY_RIGHT:184 c = findPanel.call(self, t);185 if (c) {186 nextPanel.call(self, c);187 e.halt();188 }189 break;190 case KEY_UP:191 case KEY_LEFT:192 c = findPanel.call(self, t);193 if (c) {194 prevPanel.call(self, c);195 e.halt();196 }197 break;198 case KEY_ENTER:199 case KEY_SPACE:200 c = findPanel.call(self, t);201 if (c) {202 self.fire('itemSelected', { item: c });203 e.halt();204 }205 break;206 }207 }208 S.mix(Carousel.Config, {209 aria: false210 });211 Switchable.addPlugin({212 name: "aria",213 init: function (self) {214 if (!self.config.aria) {215 return;216 }217 var triggers = self.triggers;218 var panels = self.panels;219 var content = self.content;220 var activeIndex = self.activeIndex;221 if (!content.id) {222 content.id = S.guid("ks-switchbale-content");223 }224 content.setAttribute("role", "listbox");225 var i = 0;226 S.each(triggers, function (t) {227 setTabIndex(t, activeIndex == i ? "0" : "-1");228 t.setAttribute("role", "button");229 t.setAttribute("aria-controls", content.id);230 i++;231 });232 i = 0;233 S.each(panels, function (t) {234 setTabIndex(t, "-1");235 t.setAttribute("role", "option");236 i++;237 });238 self.on("switch", _switch, self);239 var nav = self.nav;240 if (nav) {241 Event.on(nav, "keydown", _navKeydown, self);242 }243 Event.on(content, "keydown", _contentKeydown, self);244 var prevBtn = self['prevBtn'],245 nextBtn = self['nextBtn'];246 if (prevBtn) {247 setTabIndex(prevBtn, 0);248 prevBtn.setAttribute("role", "button");249 Event.on(prevBtn, "keydown", function (e) {250 if (e.keyCode == KEY_ENTER || e.keyCode == KEY_SPACE) {251 self.prev(DOM_EVENT);252 e.preventDefault();253 }254 });255 }256 if (nextBtn) {257 setTabIndex(nextBtn, 0);258 nextBtn.setAttribute("role", "button");259 Event.on(nextBtn, "keydown", function (e) {260 if (e.keyCode == KEY_ENTER || e.keyCode == KEY_SPACE) {261 self.next(DOM_EVENT);262 e.preventDefault();263 }264 });265 }266 }267 }, Carousel);268}, {269 requires: ["dom", "event", "../aria", "./base", '../base']270});271/**...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

...35 $("#bottom-bar").hide();36 });37 activity.onReady(function () {38 $("#bottom-bar").show();39 settingHelper.setTabIndex(0);40 });41});42app.on({page: 'cp_game', preventClose: false}, function (activity) {43 activity.onReady(function () {44 settingHelper.setTabIndex(1);45 });46 activity.onHashChanged(function (router) {47 console.log(router);48 var url = "/game/" + router + "&client_type=mobile";49 $("cp_game").load(url, "POST");50 $("#bottom-bar").hide();//隐藏51 });52});53//Cp类型54app.on({page: 'cp_type_list', content: "/pages/show_page?page=type_list"}, function (activity) {55 activity.onReady(function () {56 settingHelper.setTabIndex(1);57 $("#bottom-bar").show();58 });59});60//通知61app.on({page: 'notice_page', content: "/pages/show_page?page=notice_page"}, function (activity) {62 activity.onReady(function () {63 settingHelper.setTabIndex(1);64 $("#bottom-bar").hide();65 });66});67//账户变动68app.on({page: 'user_finance_logs', content: "/pages/show_page?page=user_finance_logs"}, function (activity) {69 activity.onReady(function () {70 settingHelper.setTabIndex(3);71 $("#bottom-bar").hide();//隐藏72 });73});74//投注记录75app.on({page: 'user_bets_logs', content: "/pages/show_page?page=show_bets_logs"}, function (activity) {76 activity.onReady(function () {77 settingHelper.setTabIndex(1);78 $("#bottom-bar").hide();//隐藏79 });80});81//用户控制面板82app.on({page: 'user_dashboard', content: "/pages/show_page?page=dashboard"}, function (activity) {83 activity.onReady(function () {84 settingHelper.setTabIndex(3);85 $("#bottom-bar").show();//隐藏86 });87});88//用户设置89app.on({page: 'user_setting_page', content: "/pages/show_page?page=settings"}, function (activity) {90 activity.onReady(function () {91 settingHelper.setTabIndex(3);92 });93});94//游戏记录95app.on({page: 'game_play_logs', content: "/pages/show_page?page=game_play_logs"}, function (activity) {96 activity.onReady(function () {97 settingHelper.setTabIndex(2);98 $("#bottom-bar").hide();//隐藏99 });100});101//开奖中心102app.on({page: 'cp_data_open', content: "/pages/show_page?page=cp_data_open"}, function (activity) {103 activity.onReady(function () {104 settingHelper.setTabIndex(2);105 $("#bottom-bar").hide();106 });107});108//单个开奖日志109app.on({page: 'cp_open_logs',}, function (activity) {110 activity.onHashChanged(function (router) {111 var url = "/game/" + router + "&client_type=mobile";112 $("cp_open_logs").load(url);113 });114 activity.onReady(function () {115 settingHelper.setTabIndex(2);116 });117});118//#endregion119//充值120app.on({page: 'user_pay_in', content: "/pages/show_page?page=user_pay_in"}, function (activity) {121 activity.onReady(function () {122 $("#bottom-bar").hide();123 });124});125//提现126app.on({page: 'user_pay_out', content: "/pages/show_page?page=user_pay_out"}, function (activity) {127 activity.onReady(function () {128 settingHelper.setTabIndex(2);129 });130});131//额度管理132app.on({page: 'user_ed_gl', content: "/pages/show_page?page=user_ed_gl"}, function (activity) {133 activity.onReady(function () {134 settingHelper.setTabIndex(2);135 });136});137//团队管理138app.on({page: 'agent_member_list', content: "/pages/show_page?page=agent_member_list"}, function (activity) {139 activity.onReady(function () {140 $("#bottom-bar").hide();141 });142});143app.on({page: "agent_account", content: "/pages/show_page?page=agent_account"}, function (activity) {144 activity.onReady(function () {145 $("#bottom-bar").hide();146 });147});148app.on({page: "agent_member_money", content: "/pages/show_page?page=agent_member_money"}, function (activity) {149 activity.onReady(function () {150 $("#bottom-bar").hide();151 });152});153app.on({page: "agent_member_bets", content: "/pages/show_page?page=agent_member_bets"}, function (activity) {154 activity.onReady(function () {155 $("#bottom-bar").hide();156 });157});158//客服服务159app.on({page: "kf_service_page", content: "/pages/show_page?page=kf_service_page"}, function (activity) {160 activity.onReady(function () {161 $("#bottom-bar").hide();162 });163});164//账户变动165app.on({page: 'agent_finance_logs', content: "/pages/show_page?page=agent_finance_logs"}, function (activity) {166 activity.onReady(function () {167 settingHelper.setTabIndex(3);168 $("#bottom-bar").hide();//隐藏169 });170});...

Full Screen

Full Screen

selectedTabContext.js

Source:selectedTabContext.js Github

copy

Full Screen

...10 useEffect(() => {11 window.addEventListener("hashchange", updateRoute);12 switch (route) {13 case "/":14 setTabIndex(0);15 break;16 case "/services":17 setTabIndex(1);18 setMenuIndex(0);19 break;20 case "/customsoftware":21 setTabIndex(1);22 setMenuIndex(1);23 break;24 case "/mobileapps":25 setTabIndex(1);26 setMenuIndex(2);27 break;28 case "/websites":29 setTabIndex(1);30 setMenuIndex(3);31 break;32 case "/revolution":33 setTabIndex(2);34 break;35 case "/about":36 setTabIndex(3);37 break;38 case "/contact":39 setTabIndex(4);40 break;41 case "/estimate":42 setTabIndex(5);43 break;44 default:45 break;46 }47 return () => window.removeEventListener("hashchange", updateRoute);48 }, [route]);49 return (50 <SelectedTabContext.Provider51 value={{ tabIndex, setTabIndex, menuIndex, setMenuIndex }}52 >53 {children}54 </SelectedTabContext.Provider>55 );56};...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptabbar = new WPTabBar();2wptabbar.setTabIndex(1);3var wptabbar = new WPTabBar();4wptabbar.setTabIndex(2);5var wptabbar = new WPTabBar();6wptabbar.setTabIndex(3);7var wptabbar = new WPTabBar();8wptabbar.setTabIndex(4);9var wptabbar = new WPTabBar();10wptabbar.setTabIndex(5);11var wptabbar = new WPTabBar();12wptabbar.setTabIndex(6);13var wptabbar = new WPTabBar();14wptabbar.setTabIndex(7);15var wptabbar = new WPTabBar();16wptabbar.setTabIndex(8);17var wptabbar = new WPTabBar();18wptabbar.setTabIndex(9);19var wptabbar = new WPTabBar();20wptabbar.setTabIndex(10);21var wptabbar = new WPTabBar();22wptabbar.setTabIndex(11);23var wptabbar = new WPTabBar();24wptabbar.setTabIndex(12);

Full Screen

Using AI Code Generation

copy

Full Screen

1var textbox = new kony.ui.TextBox2({2}, {3}, {4});5var btnSetTabIndex = new kony.ui.Button({6}, {7}, {});8var btnSetTabOrder = new kony.ui.Button({

Full Screen

Using AI Code Generation

copy

Full Screen

1var win = new Window("dialog", "Test", undefined);2var tabGroup = win.add("tabbedpanel");3var tab1 = tabGroup.add("tab", undefined, "Tab 1");4var tab2 = tabGroup.add("tab", undefined, "Tab 2");5tabGroup.setTabIndex(1);6win.show();

Full Screen

Using AI Code Generation

copy

Full Screen

1var tab = new YAHOO.widget.Tab({label:"Tab 1", content:"Tab 1 Content"});2tab.setTabIndex(2);3tab = new YAHOO.widget.Tab({label:"Tab 2", content:"Tab 2 Content"});4tab.setTabIndex(1);5tab = new YAHOO.widget.Tab({label:"Tab 3", content:"Tab 3 Content"});6tab.setTabIndex(3);7var tab = new YAHOO.widget.Tab({label:"Tab 1", content:"Tab 1 Content"});8alert(tab.getTabIndex());9tab = new YAHOO.widget.Tab({label:"Tab 2", content:"Tab 2 Content"});10alert(tab.getTabIndex());11tab = new YAHOO.widget.Tab({label:"Tab 3", content:"Tab 3 Content"});12alert(tab.getTabIndex());13var tab = new YAHOO.widget.Tab({label:"Tab 1", content:"Tab 1 Content"});14alert(tab.getTabIndex());15tab = new YAHOO.widget.Tab({label:"Tab 2", content:"Tab 2 Content"});16alert(tab.getTabIndex());17tab = new YAHOO.widget.Tab({label:"Tab 3", content:"Tab 3 Content"});18alert(tab.getTabIndex());19var tab = new YAHOO.widget.Tab({label:"Tab 1", content:"Tab 1 Content"});20alert(tab.getTabIndex());21tab = new YAHOO.widget.Tab({label:"Tab 2", content:"Tab 2 Content"});22alert(tab.getTabIndex());23tab = new YAHOO.widget.Tab({label:"Tab 3", content:"Tab 3 Content"});24alert(tab.getTabIndex());25var tab = new YAHOO.widget.Tab({label:"Tab 1", content:"Tab 1 Content"});26alert(tab.getTabIndex());27tab = new YAHOO.widget.Tab({label:"Tab 2", content:"Tab 2 Content"});28alert(tab.getTabIndex());29tab = new YAHOO.widget.Tab({label:"Tab 3", content:"Tab 3 Content"});30alert(tab.getTabIndex());31var tab = new YAHOO.widget.Tab({label:"Tab 1", content:"

Full Screen

Using AI Code Generation

copy

Full Screen

1var textbox = new WinJS.UI.WpTextBox(document.getElementById("textbox"));2textbox.setTabIndex(1);3textbox.setTabIndex(2);4textbox.setTabIndex(3);5textbox.setTabIndex(4);6textbox.setTabIndex(5);7textbox.setTabIndex(6);8textbox.setTabIndex(7);9textbox.setTabIndex(8);10textbox.setTabIndex(9);11textbox.setTabIndex(10);12textbox.setTabIndex(11);13textbox.setTabIndex(12);14textbox.setTabIndex(13);15textbox.setTabIndex(14);16textbox.setTabIndex(15);17textbox.setTabIndex(16);18textbox.setTabIndex(17);19textbox.setTabIndex(18);20textbox.setTabIndex(19);21textbox.setTabIndex(20);22textbox.setTabIndex(21);23textbox.setTabIndex(22);24textbox.setTabIndex(23);25textbox.setTabIndex(24);26textbox.setTabIndex(25);27textbox.setTabIndex(26);28textbox.setTabIndex(27);29textbox.setTabIndex(28);30textbox.setTabIndex(29);31textbox.setTabIndex(30);32textbox.setTabIndex(31);33textbox.setTabIndex(32);34textbox.setTabIndex(33);35textbox.setTabIndex(34);36textbox.setTabIndex(35);37textbox.setTabIndex(36);38textbox.setTabIndex(37);39textbox.setTabIndex(38);40textbox.setTabIndex(39);41textbox.setTabIndex(40);42textbox.setTabIndex(41);43textbox.setTabIndex(42);44textbox.setTabIndex(43);45textbox.setTabIndex(44);46textbox.setTabIndex(45);47textbox.setTabIndex(46);48textbox.setTabIndex(47);49textbox.setTabIndex(48);50textbox.setTabIndex(49);51textbox.setTabIndex(50);52textbox.setTabIndex(51);53textbox.setTabIndex(52);54textbox.setTabIndex(53);55textbox.setTabIndex(54);56textbox.setTabIndex(55);57textbox.setTabIndex(56);58textbox.setTabIndex(57);59textbox.setTabIndex(58);60textbox.setTabIndex(59);61textbox.setTabIndex(60);62textbox.setTabIndex(61);63textbox.setTabIndex(62);64textbox.setTabIndex(63);65textbox.setTabIndex(64);66textbox.setTabIndex(65);67textbox.setTabIndex(66);68textbox.setTabIndex(67);69textbox.setTabIndex(68);70textbox.setTabIndex(69);71textbox.setTabIndex(70);72textbox.setTabIndex(71);73textbox.setTabIndex(72);74textbox.setTabIndex(73);75textbox.setTabIndex(74);76textbox.setTabIndex(75);77textbox.setTabIndex(76);78textbox.setTabIndex(77);79textbox.setTabIndex(78);80textbox.setTabIndex(79);81textbox.setTabIndex(80);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptabcontrol = new WPTabControl();2wptabcontrol.setTabIndex(0);3setTabIndex: function (index) {4 this._activeTabIndex = index;5 this._setActiveTab(index);6},7_setActiveTab: function (index) {8 if (this._activeTabIndex > -1) {9 this._tabs[this._activeTabIndex].removeClass("wptab-active");10 }11 this._activeTabIndex = index;12 this._tabs[this._activeTabIndex].addClass("wptab-active");13 this._contentDivs[this._activeTabIndex].show();14 this._contentDivs[this._activeTabIndex].addClass("wptabcontent-active");15 this._contentDivs[this._activeTabIndex].removeClass("wptabcontent-inactive");16},17_createTab: function (index, tab) {18 tabText = tab.text(),19 tabId = tab.attr("id"),20 tabDiv = $("<div></div>").addClass("wptab").attr("id", tabId + "-tab"),21 tabContentDiv = $("<div></div>").addClass("wptabcontent-inactive").attr("id", tabId + "-content");22 if (index === 0) {23 tabDiv.addClass("wptab-active");24 tabContentDiv.addClass("wptabcontent-active");25 tabContentDiv.show();26 }27 tabDiv.append(tabText);28 tabDiv.click(function () {29 that._setActiveTab(index);30 });31 this._tabs.push(tabDiv);32 this._contentDivs.push(tabContentDiv);33 this._tabContainer.append(tabDiv);34 this._contentContainer.append(tabContentDiv);35},36_createTabs: function () {37 tabDivs = this.element.find(".wptab");38 $.each(tabDivs, function (index, tab) {39 that._createTab(index, $(tab));40 });41},

Full Screen

Using AI Code Generation

copy

Full Screen

1function test() {2 var toolBar = document.getElementById("nav-bar");3 var toolBarPalette = document.getElementById("toolbarpalette");4 var toolBarPaletteItems = toolBarPalette.childNodes;5 var toolBarItems = toolBar.childNodes;6 var toolBarItemsLength = toolBarItems.length;7 var toolBarPaletteItemsLength = toolBarPaletteItems.length;8 var i = 0;9 var j = 0;10 var toolBarItemsArray = new Array();11 var toolBarPaletteItemsArray = new Array();12 for (i = 0; i < toolBarItemsLength; i++) {13 toolBarItemsArray[i] = toolBarItems[i].id;14 }15 for (j = 0; j < toolBarPaletteItemsLength; j++) {16 toolBarPaletteItemsArray[j] = toolBarPaletteItems[j].id;17 }18 var toolBarItemsArrayLength = toolBarItemsArray.length;19 var toolBarPaletteItemsArrayLength = toolBarPaletteItemsArray.length;20 var toolBarItemsArrayIndex = 0;21 var toolBarPaletteItemsArrayIndex = 0;22 var toolBarItemsArrayObject = new Object();23 var toolBarPaletteItemsArrayObject = new Object();24 for (toolBarItemsArrayIndex = 0; toolBarItemsArrayIndex < toolBarItemsArrayLength; toolBarItemsArrayIndex++) {25 toolBarItemsArrayObject[toolBarItemsArray[toolBarItemsArrayIndex]] = toolBarItemsArrayIndex;26 }27 for (toolBarPaletteItemsArrayIndex = 0; toolBarPaletteItemsArrayIndex < toolBarPaletteItemsArrayLength; toolBarPaletteItemsArrayIndex++) {28 toolBarPaletteItemsArrayObject[toolBarPaletteItemsArray[toolBarPaletteItemsArrayIndex]] = toolBarPaletteItemsArrayIndex;29 }30 var toolBarItemsArrayObjectLength = toolBarItemsArrayObject.length;31 var toolBarPaletteItemsArrayObjectLength = toolBarPaletteItemsArrayObject.length;32 var toolBarItemsArrayObjectIndex = 0;33 var toolBarPaletteItemsArrayObjectIndex = 0;34 var toolBarItemsArrayObjectObject = new Object();35 var toolBarPaletteItemsArrayObjectObject = new Object();36 for (toolBarItemsArrayObjectIndex in toolBarItemsArrayObject) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var tabView = new WPTabView();2tabView.setTabIndex(0);3function WPTabView(){ 4 this.setTabIndex = function(index){5 }6}7var tabView = new WPTabView();8var tab = {index:0};9tabView.setTabIndex(tab);10function WPTabView(){ 11 this.setTabIndex = function(tab){12 }13}14var tabView = new WPTabView();15var tab = {};16tab.index = 0;17tabView.setTabIndex(tab);

Full Screen

Using AI Code Generation

copy

Full Screen

1var tabView = new WPTabView();2tabView.setTabIndex(1);3function WPTabView()4{5 this.tabIndex = 0;6}7WPTabView.prototype.setTabIndex = function(tabIndex)8{9 this.tabIndex = tabIndex;10}11WPTabView.prototype.setTabIndex = function(tabIndex)12{13 this.tabIndex = tabIndex;14}15WPTabView.prototype.getTabIndex = function()16{17 return this.tabIndex;18}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful