フォーカス順序制御

このサンプルでは、InputManJSのコントロールにtabIndexプロパティを設定するときにフォーカス順序の制御を確認することができます。

InputManJSでは、tabIndexプロパティを利用してTabキーによるフォーカス順序の制御を行うことができます。 tabIndexプロパティがサポートされているのは以下のコントロールです。 テキストコントロール 複数行テキストコントロール マスクコントロール 日付時刻コントロール 数値コントロール コンボコントロール このプロパティのデフォルト値は0です。 また、このプロパティを指定しない場合は通常通りブラウザに配置された順番でフォーカスが遷移します。
import '@mescius/inputman/CSS/gc.inputman-js.css'; import './styles.css'; import products from './data'; import { InputMan } from '@mescius/inputman'; InputMan.appearanceStyle = InputMan.AppearanceStyle.Modern; const gcTextBox = new InputMan.GcTextBox(document.getElementById('gcTextBox'), { text: 'テキスト', tabIndex: 1 }); const gcMultiLineTextBox = new InputMan.GcMultiLineTextBox(document.getElementById('gcMultiLineTextBox'), { text: '宮城県仙台市泉区紫山3-1-4', tabIndex: 5 }); const gcMask = new InputMan.GcMask(document.getElementById('gcMask'), { formatPattern: '〒\\D{3}-\\D{4}', tabIndex: 3 }); const gcDateTime = new InputMan.GcDateTime(document.getElementById('gcDateTime'), { tabIndex: 6 }); const gcNumber = new InputMan.GcNumber(document.getElementById('gcNumber'), { tabIndex: 2 }); const gcComboBox = new InputMan.GcComboBox(document.getElementById('gcComboBox'), { items: products, tabIndex: 4 });
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>基本機能 - フォーカス順序制御</title> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> window.onload = function() { System.import('./src/app'); } </script> </head> <body> <p>Tabキーを押下して、フォーカスの遷移順を確認してください。</p> <div class="flexbox"> <div> テキストコントロール(tabIndex=1)<br> <input id="gcTextBox"> </div> <div> 複数行テキストコントロール(tabIndex=5)<br> <textarea id="gcMultiLineTextBox"></textarea> </div> <div> マスクコントロール(tabIndex=3)<br> <input id="gcMask"> </div> <div> 日付時刻コントロール(tabIndex=6)<br> <input id="gcDateTime"> </div> <div> 数値コントロール(tabIndex=2)<br> <input id="gcNumber"> </div> <div> コンボコントロール(tabIndex=4)<br> <select id="gcComboBox"></select> </div> </div> </body> </html>
body { padding-bottom: 10rem; } .gcim { width: 200px; }
module.exports = [ '果汁100%オレンジ', 'コーヒーマイルド', 'ピリピリビール', 'ホワイトソルト', 'ブラックペッパー', 'ピュアシュガー' ];
body { padding-bottom: 10rem; } [gcim-control-appearance="modern"] .gcim { width: 200px; }
System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, meta: { '*.css': { loader: 'css' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { '@mescius/inputman': 'npm:@mescius/inputman/index.js', '@mescius/inputman/CSS': 'npm:@mescius/inputman/CSS', 'css': 'npm:systemjs-plugin-css/css.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' }, } });