fix(input): check for tabindex and pass it properly to native input (#21170)

* fix(input): check for tabindex and pass it properly to native input

references #17515

* style(input): fix lint error

* test(input): update test for more use cases (inside item)

* fix(item): adds delegatesFocus to shadow

* style(input): add comment block on what the code does
This commit is contained in:
Brandy Carney
2020-05-13 12:18:03 -04:00
committed by GitHub
parent 50678c03c9
commit dd4cb706ff
3 changed files with 99 additions and 8 deletions

View File

@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta charset="UTF-8">
<title>Input - Tabindex</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
<script src="../../../../../scripts/testing/scripts.js"></script>
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head>
<body>
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Input - Tabindex</ion-title>
<ion-buttons slot="primary">
<ion-button>
<ion-icon slot="icon-only" name="menu"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-input tabindex="0" placeholder="Tab 9th"></ion-input>
<ion-input placeholder="Tab 10th"></ion-input>
<hr>
<ion-input placeholder="Tab 8th" tabindex="8"></ion-input>
<ion-input placeholder="Skip" tabindex="-1"></ion-input>
<ion-input placeholder="Tab 7th" tabindex="7"></ion-input>
<div tabindex="0">Tab 11th</div>
<ion-input placeholder="Tab 6th" tabindex="6"></ion-input>
<ion-input placeholder="Tab 5th" tabindex="5"></ion-input>
<ion-item tabindex="4">
<ion-label position="stacked">Tab 4th</ion-label>
<ion-input></ion-input>
</ion-item>
<ion-item tabindex="3">
<ion-label position="stacked">Tab 3rd</ion-label>
<ion-input></ion-input>
</ion-item>
<ion-item tabindex="-1">
<ion-label position="stacked">Skip</ion-label>
<ion-input></ion-input>
</ion-item>
<ion-item tabindex="2">
<ion-label position="stacked">Tab 2nd</ion-label>
<ion-input></ion-input>
</ion-item>
<ion-item tabindex="1">
<ion-label position="stacked">Tab 1st</ion-label>
<ion-input></ion-input>
</ion-item>
</ion-content>
<style>
ion-input,
div {
margin-bottom: 10px;
}
.md div {
padding-left: 8px;
}
</style>
</ion-app>
</body>
</html>