MathMLElement:tabIndex 屬性
MathMLElement 介面的 tabIndex 屬性表示當前 MathML 元素的 tab 順序。
焦點順序如下:
- 具有正數
tabIndex的元素。tabIndex值相同的元素應按其出現的順序導航。導航從最低tabIndex到最高tabIndex進行。 - 不支援
tabIndex屬性或支援該屬性但將其值賦為0的元素,按其出現的順序導航。
被停用的元素不參與 tab 順序。值不需要是連續的,也不需要從任何特定值開始。它們甚至可以是負數,儘管每個瀏覽器都會修剪非常大的值。
值
一個整數。
示例
使用 tabIndex 屬性
html
<math id="math1" tabindex="2">
<msup>
<mi>a</mi>
<mn>2</mn>
</msup>
</math>
<math id="math2">
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
</math>
js
const math1 = document.getElementById("math1");
const math2 = document.getElementById("math2");
// Access and modify the tabIndex
console.log(math1.tabIndex); // 2
math2.tabIndex = 1; // Add math2 to the tab order before math1
// Programmatically focus on an element with negative tabIndex
math1.tabIndex = -1;
math1.focus(); // Works, even though it is not in the tabbing order
結果
規範
| 規範 |
|---|
| HTML # dom-tabindex |
瀏覽器相容性
載入中…